Replies: 5 comments 2 replies
-
@48cork Did you compile and deploy the contract and make sure the functions are public or external? |
Beta Was this translation helpful? Give feedback.
1 reply
-
Yes, I did that, but even so, the buttons didn't appear |
Beta Was this translation helpful? Give feedback.
1 reply
-
```solidity
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.8;
// EVM, Ethereum Virtual Machine
// Avalhance, Fantom, Polygon
contract SimpleStorage {
// This gets initialized to zero !
// <- This means that this section is a comment!
uint256 favoriteNumber;
mapping(string => uint256) public nameToFavoriteNumber;
struct People {
uint256 favoriteNumber;
string name;
}
// uint256[] public favoriteNumberList;
People[] public people;
function store(uint256 _favoriteNumber) public{
favoriteNumber = _favoriteNumber;
}
//view, pure
function retrieve() public view returns(uint256){
return favoriteNumber;
// calldata, memory, sotorage
function addPerson(string memory _name, uint256 _favoriteNumber)
public {
people.push(People(_favoriteNumber, _name));
nameTofavoriteNumber[_Name] = _favoriteNumber;;
}
}
}
```
|
Beta Was this translation helpful? Give feedback.
0 replies
-
After copying and pasting at Remix the code correction above, it looks
better, but any button has appeared. At the same time, I got the
message below
Gas costs:Gas requirement of function SimpleStorage.addPerson is infinite:
If the gas requirement of a function is higher than the block gas limit, it
cannot be executed. Please avoid loops in your functions or actions that
modify large areas of storage (this includes clearing or copying arrays in
storage)Pos: 32:4:
…On Sat, Mar 4, 2023 at 2:20 AM Ali Murtaza ***@***.***> wrote:
@48cork <https://github.com/48cork> Try this fixed code, it is now
working;
// SPDX-License-Identifier: MITpragma solidity ^0.8.8;
// EVM, Ethereum Virtual Machine// Avalhance, Fantom, Polygon
contract SimpleStorage {
// This gets initialized to zero !
// <- This means that this section is a comment!
uint256 public favoriteNumber;
mapping(string => uint256) public nameToFavoriteNumber;
struct People {
uint256 favoriteNumber;
string name;
}
// uint256[] public favoriteNumberList;
People[] public people;
function store(uint256 _favoriteNumber) public {
favoriteNumber = _favoriteNumber;
}
//view, pure
function retrieve() public view returns(uint256) {
return favoriteNumber;
// calldata, memory, sotorage
}
function addPerson(string memory _name, uint256 _favoriteNumber) public {
people.push(People(_favoriteNumber, _name));
nameToFavoriteNumber[_name] = _favoriteNumber;
}
}
—
Reply to this email directly, view it on GitHub
<#4999 (reply in thread)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/A6CUZI6PY4GRMGAEBQSATOTW2L3NZANCNFSM6AAAAAAVOLSSD4>
.
You are receiving this because you were mentioned.Message ID:
<smartcontractkit/full-blockchain-solidity-course-js/repo-discussions/4999/comments/5200093
@github.com>
|
Beta Was this translation helpful? Give feedback.
0 replies
-
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
The Remix doesnt show buttons like store, favoriteNumber. How could I fix that
Beta Was this translation helpful? Give feedback.
All reactions