You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
function create(string memory addr) public { //creates the first object in the array and set your address as the owner
accounts[counter++] = Account(addr, 42);
owner = msg.sender;
}
function get(uint nr) public view returns (string memory) { //returns the address of the position "nr"
return accounts[nr].addr;
}
function getAmount(uint nr) public view returns (uint) { //returns the amount saved for the position "nr"
return accounts[nr].amount;
}
function set(uint nr, string memory addr) public returns (bool) { //sets an amount for an address (only possible if the sender of the msg is the owner)