Created
May 26, 2022 13:21
-
-
Save IgnacioPardo/4c027136f4784817d2d0a4bd4dd24ecd to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// SPDX-License-Identifier: MIT | |
pragma solidity ^0.8.10; | |
contract Superheroe{ | |
string private _name; | |
mapping(string => uint) private _poderes; | |
address private _owner; | |
constructor(string memory name_){ | |
_name = name_; | |
_owner = msg.sender; | |
} | |
function name() public view returns (string memory){ | |
return _name; | |
} | |
function set_power(string memory poder, uint valor) public{ | |
require(msg.sender == _owner, "Solo el owner puede setear poderes"); | |
_poderes[poder] = valor; | |
} | |
function get_power(string memory poder) public view returns (uint){ | |
return _poderes[poder]; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment