Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View agoiabel's full-sized avatar

Agoi Abel Adeyemi agoiabel

  • Aveiro Portugal
View GitHub Profile
pragma solidity ^0.6.4;
contract Token {
...
...
mapping(address => uint) public balanceOf;
event Transfer(address indexed _from, address indexed _to, uint256 _value);
pragma solidity ^0.6.4;
contract Token {
...
...
mapping(address => uint) public balanceOf;
event Transfer(address indexed _from, address indexed _to, uint256 _value);
function transfer(address _to, uint _value) public returns (bool success) {
pragma solidity ^0.6.4;
contract Token {
uint public totalSupply;
mapping(address => uint) public balanceOf;
constructor(uint _totalSupply) {
totalSupply = _totalSupply;
balance[msg.sender] = _totalSupply;
}
pragma solidity ^0.6.4;
contract Token {
uint public totalSupply;
constructor(uint _totalSupply) {
totalSupply = _totalSupply;
}
}
pragma solidity ^0.6.4;
contract Token {
}
pragma solidity ^0.6.4;
contract Token {
uint public decimals = 18;
string public symbol = 'AT';
string public name = 'Agoi Token';
}
module.exports = {
networks: {
development: {
host: "127.0.0.1", // Localhost (default: none)
port: 7545, // Standard Ethereum port (default: none)
network_id: "*", // Any network (default: none)
},
},
pragma solidity ^0.5.3;
contract Mapping {
mapping(address => uint) balances;
mapping(address => mapping(address => bool)) approved;
function manipulateMapOfMap(spender) external {
approved[msg.sender][spender] = true //assign a value to the approved map
approved[msg.sender][spender]; //get the value of the map
pragma solidity ^0.5.3;
contract Mapping {
mapping(address => uint[]) scores;
function manipulateArrayMap() external {
scores[msg.sender].push(1); //assign a value;
scores[msg.sender].push(2); //assign another element
pragma solidity ^0.5.3;
contract Mapping {
mapping(address => uint) balances;
function manipulateMap() external {
balances[msg.sender] = 100; //assign a value;
balances[msg.sender] //read a value;