contract_name
stringlengths
1
61
file_path
stringlengths
5
50.4k
contract_address
stringlengths
42
42
language
stringclasses
1 value
class_name
stringlengths
1
61
class_code
stringlengths
4
330k
class_documentation
stringlengths
0
29.1k
class_documentation_type
stringclasses
6 values
func_name
stringlengths
0
62
func_code
stringlengths
1
303k
func_documentation
stringlengths
2
14.9k
func_documentation_type
stringclasses
4 values
compiler_version
stringlengths
15
42
license_type
stringclasses
14 values
swarm_source
stringlengths
0
71
meta
dict
__index_level_0__
int64
0
60.4k
DelegatedSending
DelegatedSending.sol
0xf7908ab1f1e352f83c5ebc75051c0565aeaea5fb
Solidity
DelegatedSending
contract DelegatedSending is ReadsAzimuth { // Pool: :who was given their own pool by :prefix, of :size invites // event Pool(uint16 indexed prefix, uint32 indexed who, uint16 size); // Sent: :by sent :point // event Sent( uint16 indexed prefix, uint32 indexed fromPool, uint32 by, uint32 point, address to); // pools: per pool, the amount of planets that can still be given away // per star by the pool's planet itself or the ones it invited // // pools are associated with planets by number, // then with stars by number. // pool 0 does not exist, and is used symbolically by :fromPool. // mapping(uint32 => mapping(uint16 => uint16)) public pools; // fromPool: per planet, the pool from which they send invites // // when invited by planet n, the invitee sends from n's pool. // a pool of 0 means the planet has its own invite pool. // mapping(uint32 => uint32) public fromPool; // poolStars: per pool, the stars from which it has received invites // mapping(uint32 => uint16[]) public poolStars; // poolStarsRegistered: per pool, per star, whether or not it is in // the :poolStars array // mapping(uint32 => mapping(uint16 => bool)) public poolStarsRegistered; // inviters: points with their own pools, invite tree roots // uint32[] public inviters; // isInviter: whether or not a point is in the :inviters list // mapping(uint32 => bool) public isInviter; // invited: for each point, the points they invited // mapping(uint32 => uint32[]) public invited; // invitedBy: for each point, the point they were invited by // mapping(uint32 => uint32) public invitedBy; // constructor(): register the azimuth contract // constructor(Azimuth _azimuth) ReadsAzimuth(_azimuth) public { // } // setPoolSize(): give _for their own pool if they don't have one already, // and allow them to send _size points from _as // function setPoolSize(uint16 _as, uint32 _for, uint16 _size) external activePointOwner(_as) { fromPool[_for] = 0; pools[_for][_as] = _size; // register star as having given invites to pool, // if that hasn't happened yet // if (false == poolStarsRegistered[_for][_as]) { poolStars[_for].push(_as); poolStarsRegistered[_for][_as] = true; } // add _for as an invite tree root // if (false == isInviter[_for]) { isInviter[_for] = true; inviters.push(_for); } emit Pool(_as, _for, _size); } // sendPoint(): as the point _as, spawn the point _point to _to. // // Requirements: // - :msg.sender must be the owner of _as, // - _to must not be the :msg.sender, // - _as must be able to send the _point according to canSend() // function sendPoint(uint32 _as, uint32 _point, address _to) external activePointOwner(_as) { require(canSend(_as, _point)); // caller may not send to themselves // require(msg.sender != _to); // recipient must be eligible to receive a planet from this contract // require(canReceive(_to)); // remove an invite from _as' current pool // uint32 pool = getPool(_as); uint16 prefix = azimuth.getPrefix(_point); pools[pool][prefix]--; // associate the _point with this pool // fromPool[_point] = pool; // add _point to _as' invite tree // invited[_as].push(_point); invitedBy[_point] = _as; // spawn _point to _to, they still need to accept the transfer manually // Ecliptic(azimuth.owner()).spawn(_point, _to); emit Sent(prefix, pool, _as, _point, _to); } // canSend(): check whether current conditions allow _as to send _point // function canSend(uint32 _as, uint32 _point) public view returns (bool result) { uint16 prefix = azimuth.getPrefix(_point); uint32 pool = getPool(_as); return ( // _as' pool for this prefix must not have been exhausted yet // (0 < pools[pool][prefix]) && // // _point needs to not be (in the process of being) spawned // azimuth.isOwner(_point, 0x0) && // // this contract must have permission to spawn points // azimuth.isSpawnProxy(prefix, this) && // // the prefix must be linked // azimuth.hasBeenLinked(prefix) && // // the prefix must not have hit its spawn limit yet // ( azimuth.getSpawnCount(prefix) < Ecliptic(azimuth.owner()) .getSpawnLimit(prefix, block.timestamp) ) ); } // getPool(): get the invite pool _point belongs to // function getPool(uint32 _point) public view returns (uint32 pool) { pool = fromPool[_point]; // no pool explicitly registered means they have their own pool, // because they either were not invited by this contract, or have // been granted their own pool by their star. // if (0 == pool) { // send from the planet's own pool, see also :fromPool // return _point; } return pool; } // canReceive(): whether the _recipient is eligible to receive a planet // from this contract or not // // only those who don't own or are entitled to any points may receive // function canReceive(address _recipient) public view returns (bool result) { return ( 0 == azimuth.getOwnedPointCount(_recipient) && 0 == azimuth.getTransferringForCount(_recipient) ); } // getPoolStars(): returns a list of stars _who has pools for // function getPoolStars(uint32 _who) external view returns (uint16[] stars) { return poolStars[_who]; } // getInviters(): returns a list of all points with their own pools // function getInviters() external view returns (uint32[] invs) { return inviters; } // getInvited(): returns a list of points invited by _who // function getInvited(uint32 _who) external view returns (uint32[] invd) { return invited[_who]; } }
// DelegatedSending: invite-like point sending // // This contract allows planet owners to gift planets to their friends, // if a star has allowed it. // // Star owners can grant a number of "invites" to planets. An "invite" in // the context of this contract means a planet from the same parent star, // that can be sent to an Ethereum address that owns no points. // Planets that were sent as invites are also allowed to send invites, but // instead of adhering to a star-set limit, they will use up invites from // the same "pool" as their inviter. // // To allow planets to be sent by this contract, stars must set it as // their spawnProxy using the Ecliptic. //
LineComment
canReceive
function canReceive(address _recipient) public view returns (bool result) { return ( 0 == azimuth.getOwnedPointCount(_recipient) && 0 == azimuth.getTransferringForCount(_recipient) ); }
// canReceive(): whether the _recipient is eligible to receive a planet // from this contract or not // // only those who don't own or are entitled to any points may receive //
LineComment
v0.4.24+commit.e67f0147
MIT
bzzr://c3e090bdc98c036b421a1fe9195484d6c637a7cbd60674bdb2b7c38412122e01
{ "func_code_index": [ 5757, 5985 ] }
2,007
DelegatedSending
DelegatedSending.sol
0xf7908ab1f1e352f83c5ebc75051c0565aeaea5fb
Solidity
DelegatedSending
contract DelegatedSending is ReadsAzimuth { // Pool: :who was given their own pool by :prefix, of :size invites // event Pool(uint16 indexed prefix, uint32 indexed who, uint16 size); // Sent: :by sent :point // event Sent( uint16 indexed prefix, uint32 indexed fromPool, uint32 by, uint32 point, address to); // pools: per pool, the amount of planets that can still be given away // per star by the pool's planet itself or the ones it invited // // pools are associated with planets by number, // then with stars by number. // pool 0 does not exist, and is used symbolically by :fromPool. // mapping(uint32 => mapping(uint16 => uint16)) public pools; // fromPool: per planet, the pool from which they send invites // // when invited by planet n, the invitee sends from n's pool. // a pool of 0 means the planet has its own invite pool. // mapping(uint32 => uint32) public fromPool; // poolStars: per pool, the stars from which it has received invites // mapping(uint32 => uint16[]) public poolStars; // poolStarsRegistered: per pool, per star, whether or not it is in // the :poolStars array // mapping(uint32 => mapping(uint16 => bool)) public poolStarsRegistered; // inviters: points with their own pools, invite tree roots // uint32[] public inviters; // isInviter: whether or not a point is in the :inviters list // mapping(uint32 => bool) public isInviter; // invited: for each point, the points they invited // mapping(uint32 => uint32[]) public invited; // invitedBy: for each point, the point they were invited by // mapping(uint32 => uint32) public invitedBy; // constructor(): register the azimuth contract // constructor(Azimuth _azimuth) ReadsAzimuth(_azimuth) public { // } // setPoolSize(): give _for their own pool if they don't have one already, // and allow them to send _size points from _as // function setPoolSize(uint16 _as, uint32 _for, uint16 _size) external activePointOwner(_as) { fromPool[_for] = 0; pools[_for][_as] = _size; // register star as having given invites to pool, // if that hasn't happened yet // if (false == poolStarsRegistered[_for][_as]) { poolStars[_for].push(_as); poolStarsRegistered[_for][_as] = true; } // add _for as an invite tree root // if (false == isInviter[_for]) { isInviter[_for] = true; inviters.push(_for); } emit Pool(_as, _for, _size); } // sendPoint(): as the point _as, spawn the point _point to _to. // // Requirements: // - :msg.sender must be the owner of _as, // - _to must not be the :msg.sender, // - _as must be able to send the _point according to canSend() // function sendPoint(uint32 _as, uint32 _point, address _to) external activePointOwner(_as) { require(canSend(_as, _point)); // caller may not send to themselves // require(msg.sender != _to); // recipient must be eligible to receive a planet from this contract // require(canReceive(_to)); // remove an invite from _as' current pool // uint32 pool = getPool(_as); uint16 prefix = azimuth.getPrefix(_point); pools[pool][prefix]--; // associate the _point with this pool // fromPool[_point] = pool; // add _point to _as' invite tree // invited[_as].push(_point); invitedBy[_point] = _as; // spawn _point to _to, they still need to accept the transfer manually // Ecliptic(azimuth.owner()).spawn(_point, _to); emit Sent(prefix, pool, _as, _point, _to); } // canSend(): check whether current conditions allow _as to send _point // function canSend(uint32 _as, uint32 _point) public view returns (bool result) { uint16 prefix = azimuth.getPrefix(_point); uint32 pool = getPool(_as); return ( // _as' pool for this prefix must not have been exhausted yet // (0 < pools[pool][prefix]) && // // _point needs to not be (in the process of being) spawned // azimuth.isOwner(_point, 0x0) && // // this contract must have permission to spawn points // azimuth.isSpawnProxy(prefix, this) && // // the prefix must be linked // azimuth.hasBeenLinked(prefix) && // // the prefix must not have hit its spawn limit yet // ( azimuth.getSpawnCount(prefix) < Ecliptic(azimuth.owner()) .getSpawnLimit(prefix, block.timestamp) ) ); } // getPool(): get the invite pool _point belongs to // function getPool(uint32 _point) public view returns (uint32 pool) { pool = fromPool[_point]; // no pool explicitly registered means they have their own pool, // because they either were not invited by this contract, or have // been granted their own pool by their star. // if (0 == pool) { // send from the planet's own pool, see also :fromPool // return _point; } return pool; } // canReceive(): whether the _recipient is eligible to receive a planet // from this contract or not // // only those who don't own or are entitled to any points may receive // function canReceive(address _recipient) public view returns (bool result) { return ( 0 == azimuth.getOwnedPointCount(_recipient) && 0 == azimuth.getTransferringForCount(_recipient) ); } // getPoolStars(): returns a list of stars _who has pools for // function getPoolStars(uint32 _who) external view returns (uint16[] stars) { return poolStars[_who]; } // getInviters(): returns a list of all points with their own pools // function getInviters() external view returns (uint32[] invs) { return inviters; } // getInvited(): returns a list of points invited by _who // function getInvited(uint32 _who) external view returns (uint32[] invd) { return invited[_who]; } }
// DelegatedSending: invite-like point sending // // This contract allows planet owners to gift planets to their friends, // if a star has allowed it. // // Star owners can grant a number of "invites" to planets. An "invite" in // the context of this contract means a planet from the same parent star, // that can be sent to an Ethereum address that owns no points. // Planets that were sent as invites are also allowed to send invites, but // instead of adhering to a star-set limit, they will use up invites from // the same "pool" as their inviter. // // To allow planets to be sent by this contract, stars must set it as // their spawnProxy using the Ecliptic. //
LineComment
getPoolStars
function getPoolStars(uint32 _who) external view returns (uint16[] stars) { return poolStars[_who]; }
// getPoolStars(): returns a list of stars _who has pools for //
LineComment
v0.4.24+commit.e67f0147
MIT
bzzr://c3e090bdc98c036b421a1fe9195484d6c637a7cbd60674bdb2b7c38412122e01
{ "func_code_index": [ 6060, 6190 ] }
2,008
DelegatedSending
DelegatedSending.sol
0xf7908ab1f1e352f83c5ebc75051c0565aeaea5fb
Solidity
DelegatedSending
contract DelegatedSending is ReadsAzimuth { // Pool: :who was given their own pool by :prefix, of :size invites // event Pool(uint16 indexed prefix, uint32 indexed who, uint16 size); // Sent: :by sent :point // event Sent( uint16 indexed prefix, uint32 indexed fromPool, uint32 by, uint32 point, address to); // pools: per pool, the amount of planets that can still be given away // per star by the pool's planet itself or the ones it invited // // pools are associated with planets by number, // then with stars by number. // pool 0 does not exist, and is used symbolically by :fromPool. // mapping(uint32 => mapping(uint16 => uint16)) public pools; // fromPool: per planet, the pool from which they send invites // // when invited by planet n, the invitee sends from n's pool. // a pool of 0 means the planet has its own invite pool. // mapping(uint32 => uint32) public fromPool; // poolStars: per pool, the stars from which it has received invites // mapping(uint32 => uint16[]) public poolStars; // poolStarsRegistered: per pool, per star, whether or not it is in // the :poolStars array // mapping(uint32 => mapping(uint16 => bool)) public poolStarsRegistered; // inviters: points with their own pools, invite tree roots // uint32[] public inviters; // isInviter: whether or not a point is in the :inviters list // mapping(uint32 => bool) public isInviter; // invited: for each point, the points they invited // mapping(uint32 => uint32[]) public invited; // invitedBy: for each point, the point they were invited by // mapping(uint32 => uint32) public invitedBy; // constructor(): register the azimuth contract // constructor(Azimuth _azimuth) ReadsAzimuth(_azimuth) public { // } // setPoolSize(): give _for their own pool if they don't have one already, // and allow them to send _size points from _as // function setPoolSize(uint16 _as, uint32 _for, uint16 _size) external activePointOwner(_as) { fromPool[_for] = 0; pools[_for][_as] = _size; // register star as having given invites to pool, // if that hasn't happened yet // if (false == poolStarsRegistered[_for][_as]) { poolStars[_for].push(_as); poolStarsRegistered[_for][_as] = true; } // add _for as an invite tree root // if (false == isInviter[_for]) { isInviter[_for] = true; inviters.push(_for); } emit Pool(_as, _for, _size); } // sendPoint(): as the point _as, spawn the point _point to _to. // // Requirements: // - :msg.sender must be the owner of _as, // - _to must not be the :msg.sender, // - _as must be able to send the _point according to canSend() // function sendPoint(uint32 _as, uint32 _point, address _to) external activePointOwner(_as) { require(canSend(_as, _point)); // caller may not send to themselves // require(msg.sender != _to); // recipient must be eligible to receive a planet from this contract // require(canReceive(_to)); // remove an invite from _as' current pool // uint32 pool = getPool(_as); uint16 prefix = azimuth.getPrefix(_point); pools[pool][prefix]--; // associate the _point with this pool // fromPool[_point] = pool; // add _point to _as' invite tree // invited[_as].push(_point); invitedBy[_point] = _as; // spawn _point to _to, they still need to accept the transfer manually // Ecliptic(azimuth.owner()).spawn(_point, _to); emit Sent(prefix, pool, _as, _point, _to); } // canSend(): check whether current conditions allow _as to send _point // function canSend(uint32 _as, uint32 _point) public view returns (bool result) { uint16 prefix = azimuth.getPrefix(_point); uint32 pool = getPool(_as); return ( // _as' pool for this prefix must not have been exhausted yet // (0 < pools[pool][prefix]) && // // _point needs to not be (in the process of being) spawned // azimuth.isOwner(_point, 0x0) && // // this contract must have permission to spawn points // azimuth.isSpawnProxy(prefix, this) && // // the prefix must be linked // azimuth.hasBeenLinked(prefix) && // // the prefix must not have hit its spawn limit yet // ( azimuth.getSpawnCount(prefix) < Ecliptic(azimuth.owner()) .getSpawnLimit(prefix, block.timestamp) ) ); } // getPool(): get the invite pool _point belongs to // function getPool(uint32 _point) public view returns (uint32 pool) { pool = fromPool[_point]; // no pool explicitly registered means they have their own pool, // because they either were not invited by this contract, or have // been granted their own pool by their star. // if (0 == pool) { // send from the planet's own pool, see also :fromPool // return _point; } return pool; } // canReceive(): whether the _recipient is eligible to receive a planet // from this contract or not // // only those who don't own or are entitled to any points may receive // function canReceive(address _recipient) public view returns (bool result) { return ( 0 == azimuth.getOwnedPointCount(_recipient) && 0 == azimuth.getTransferringForCount(_recipient) ); } // getPoolStars(): returns a list of stars _who has pools for // function getPoolStars(uint32 _who) external view returns (uint16[] stars) { return poolStars[_who]; } // getInviters(): returns a list of all points with their own pools // function getInviters() external view returns (uint32[] invs) { return inviters; } // getInvited(): returns a list of points invited by _who // function getInvited(uint32 _who) external view returns (uint32[] invd) { return invited[_who]; } }
// DelegatedSending: invite-like point sending // // This contract allows planet owners to gift planets to their friends, // if a star has allowed it. // // Star owners can grant a number of "invites" to planets. An "invite" in // the context of this contract means a planet from the same parent star, // that can be sent to an Ethereum address that owns no points. // Planets that were sent as invites are also allowed to send invites, but // instead of adhering to a star-set limit, they will use up invites from // the same "pool" as their inviter. // // To allow planets to be sent by this contract, stars must set it as // their spawnProxy using the Ecliptic. //
LineComment
getInviters
function getInviters() external view returns (uint32[] invs) { return inviters; }
// getInviters(): returns a list of all points with their own pools //
LineComment
v0.4.24+commit.e67f0147
MIT
bzzr://c3e090bdc98c036b421a1fe9195484d6c637a7cbd60674bdb2b7c38412122e01
{ "func_code_index": [ 6271, 6381 ] }
2,009
DelegatedSending
DelegatedSending.sol
0xf7908ab1f1e352f83c5ebc75051c0565aeaea5fb
Solidity
DelegatedSending
contract DelegatedSending is ReadsAzimuth { // Pool: :who was given their own pool by :prefix, of :size invites // event Pool(uint16 indexed prefix, uint32 indexed who, uint16 size); // Sent: :by sent :point // event Sent( uint16 indexed prefix, uint32 indexed fromPool, uint32 by, uint32 point, address to); // pools: per pool, the amount of planets that can still be given away // per star by the pool's planet itself or the ones it invited // // pools are associated with planets by number, // then with stars by number. // pool 0 does not exist, and is used symbolically by :fromPool. // mapping(uint32 => mapping(uint16 => uint16)) public pools; // fromPool: per planet, the pool from which they send invites // // when invited by planet n, the invitee sends from n's pool. // a pool of 0 means the planet has its own invite pool. // mapping(uint32 => uint32) public fromPool; // poolStars: per pool, the stars from which it has received invites // mapping(uint32 => uint16[]) public poolStars; // poolStarsRegistered: per pool, per star, whether or not it is in // the :poolStars array // mapping(uint32 => mapping(uint16 => bool)) public poolStarsRegistered; // inviters: points with their own pools, invite tree roots // uint32[] public inviters; // isInviter: whether or not a point is in the :inviters list // mapping(uint32 => bool) public isInviter; // invited: for each point, the points they invited // mapping(uint32 => uint32[]) public invited; // invitedBy: for each point, the point they were invited by // mapping(uint32 => uint32) public invitedBy; // constructor(): register the azimuth contract // constructor(Azimuth _azimuth) ReadsAzimuth(_azimuth) public { // } // setPoolSize(): give _for their own pool if they don't have one already, // and allow them to send _size points from _as // function setPoolSize(uint16 _as, uint32 _for, uint16 _size) external activePointOwner(_as) { fromPool[_for] = 0; pools[_for][_as] = _size; // register star as having given invites to pool, // if that hasn't happened yet // if (false == poolStarsRegistered[_for][_as]) { poolStars[_for].push(_as); poolStarsRegistered[_for][_as] = true; } // add _for as an invite tree root // if (false == isInviter[_for]) { isInviter[_for] = true; inviters.push(_for); } emit Pool(_as, _for, _size); } // sendPoint(): as the point _as, spawn the point _point to _to. // // Requirements: // - :msg.sender must be the owner of _as, // - _to must not be the :msg.sender, // - _as must be able to send the _point according to canSend() // function sendPoint(uint32 _as, uint32 _point, address _to) external activePointOwner(_as) { require(canSend(_as, _point)); // caller may not send to themselves // require(msg.sender != _to); // recipient must be eligible to receive a planet from this contract // require(canReceive(_to)); // remove an invite from _as' current pool // uint32 pool = getPool(_as); uint16 prefix = azimuth.getPrefix(_point); pools[pool][prefix]--; // associate the _point with this pool // fromPool[_point] = pool; // add _point to _as' invite tree // invited[_as].push(_point); invitedBy[_point] = _as; // spawn _point to _to, they still need to accept the transfer manually // Ecliptic(azimuth.owner()).spawn(_point, _to); emit Sent(prefix, pool, _as, _point, _to); } // canSend(): check whether current conditions allow _as to send _point // function canSend(uint32 _as, uint32 _point) public view returns (bool result) { uint16 prefix = azimuth.getPrefix(_point); uint32 pool = getPool(_as); return ( // _as' pool for this prefix must not have been exhausted yet // (0 < pools[pool][prefix]) && // // _point needs to not be (in the process of being) spawned // azimuth.isOwner(_point, 0x0) && // // this contract must have permission to spawn points // azimuth.isSpawnProxy(prefix, this) && // // the prefix must be linked // azimuth.hasBeenLinked(prefix) && // // the prefix must not have hit its spawn limit yet // ( azimuth.getSpawnCount(prefix) < Ecliptic(azimuth.owner()) .getSpawnLimit(prefix, block.timestamp) ) ); } // getPool(): get the invite pool _point belongs to // function getPool(uint32 _point) public view returns (uint32 pool) { pool = fromPool[_point]; // no pool explicitly registered means they have their own pool, // because they either were not invited by this contract, or have // been granted their own pool by their star. // if (0 == pool) { // send from the planet's own pool, see also :fromPool // return _point; } return pool; } // canReceive(): whether the _recipient is eligible to receive a planet // from this contract or not // // only those who don't own or are entitled to any points may receive // function canReceive(address _recipient) public view returns (bool result) { return ( 0 == azimuth.getOwnedPointCount(_recipient) && 0 == azimuth.getTransferringForCount(_recipient) ); } // getPoolStars(): returns a list of stars _who has pools for // function getPoolStars(uint32 _who) external view returns (uint16[] stars) { return poolStars[_who]; } // getInviters(): returns a list of all points with their own pools // function getInviters() external view returns (uint32[] invs) { return inviters; } // getInvited(): returns a list of points invited by _who // function getInvited(uint32 _who) external view returns (uint32[] invd) { return invited[_who]; } }
// DelegatedSending: invite-like point sending // // This contract allows planet owners to gift planets to their friends, // if a star has allowed it. // // Star owners can grant a number of "invites" to planets. An "invite" in // the context of this contract means a planet from the same parent star, // that can be sent to an Ethereum address that owns no points. // Planets that were sent as invites are also allowed to send invites, but // instead of adhering to a star-set limit, they will use up invites from // the same "pool" as their inviter. // // To allow planets to be sent by this contract, stars must set it as // their spawnProxy using the Ecliptic. //
LineComment
getInvited
function getInvited(uint32 _who) external view returns (uint32[] invd) { return invited[_who]; }
// getInvited(): returns a list of points invited by _who //
LineComment
v0.4.24+commit.e67f0147
MIT
bzzr://c3e090bdc98c036b421a1fe9195484d6c637a7cbd60674bdb2b7c38412122e01
{ "func_code_index": [ 6452, 6577 ] }
2,010
HatAirdrop
HatAirdrop.sol
0x63f28989cca095e61b1dc74050e6132eeb4cb7c3
Solidity
Address
library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== */ function isContract(address account) internal view returns (bool) { // According to EIP-1052, 0x0 is the value returned for not-yet created accounts // and 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470 is returned // for accounts without code, i.e. `keccak256('')` bytes32 codehash; bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470; // solhint-disable-next-line no-inline-assembly assembly { codehash := extcodehash(account) } return (codehash != accountHash && codehash != 0x0); } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); // solhint-disable-next-line avoid-low-level-calls, avoid-call-value (bool success, ) = recipient.call{ value: amount }(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain`call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCall(target, data, "Address: low-level call failed"); } /** * @dev Same as {Address-functionCall-address-bytes-}, but with * `errorMessage` as a fallback revert reason when `target` reverts. */ function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) { return _functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Performs a Solidity function call using a low level `call`, * transferring `value` wei. A plain`call` is an unsafe replacement for a * function call: use this function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Requirements: * * - `target` must be a contract. * - the calling contract must have an ETH balance of at least `value`. * - calling `target` with `data` must not revert. */ function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {Address-functionCallWithValue-address-bytes-uint256-}, but * with `errorMessage` as a fallback revert reason when `target` reverts. */ function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); return _functionCallWithValue(target, data, value, errorMessage); } function _functionCallWithValue(address target, bytes memory data, uint256 weiValue, string memory errorMessage) private returns (bytes memory) { require(isContract(target), "Address: call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.call{ value: weiValue }(data); if (success) { return returndata; } else { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly // solhint-disable-next-line no-inline-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } }
/** * @dev Collection of functions related to the address type */
NatSpecMultiLine
isContract
function isContract(address account) internal view returns (bool) { // According to EIP-1052, 0x0 is the value returned for not-yet created accounts // and 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470 is returned // for accounts without code, i.e. `keccak256('')` bytes32 codehash; bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470; // solhint-disable-next-line no-inline-assembly assembly { codehash := extcodehash(account) } return (codehash != accountHash && codehash != 0x0); }
/** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== */
NatSpecMultiLine
v0.6.6+commit.6c089d02
MIT
ipfs://75e0826307cea4fcdb14e513c28c765678b11bf94c772e7638ae18889c1108e1
{ "func_code_index": [ 606, 1230 ] }
2,011
HatAirdrop
HatAirdrop.sol
0x63f28989cca095e61b1dc74050e6132eeb4cb7c3
Solidity
Address
library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== */ function isContract(address account) internal view returns (bool) { // According to EIP-1052, 0x0 is the value returned for not-yet created accounts // and 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470 is returned // for accounts without code, i.e. `keccak256('')` bytes32 codehash; bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470; // solhint-disable-next-line no-inline-assembly assembly { codehash := extcodehash(account) } return (codehash != accountHash && codehash != 0x0); } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); // solhint-disable-next-line avoid-low-level-calls, avoid-call-value (bool success, ) = recipient.call{ value: amount }(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain`call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCall(target, data, "Address: low-level call failed"); } /** * @dev Same as {Address-functionCall-address-bytes-}, but with * `errorMessage` as a fallback revert reason when `target` reverts. */ function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) { return _functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Performs a Solidity function call using a low level `call`, * transferring `value` wei. A plain`call` is an unsafe replacement for a * function call: use this function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Requirements: * * - `target` must be a contract. * - the calling contract must have an ETH balance of at least `value`. * - calling `target` with `data` must not revert. */ function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {Address-functionCallWithValue-address-bytes-uint256-}, but * with `errorMessage` as a fallback revert reason when `target` reverts. */ function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); return _functionCallWithValue(target, data, value, errorMessage); } function _functionCallWithValue(address target, bytes memory data, uint256 weiValue, string memory errorMessage) private returns (bytes memory) { require(isContract(target), "Address: call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.call{ value: weiValue }(data); if (success) { return returndata; } else { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly // solhint-disable-next-line no-inline-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } }
/** * @dev Collection of functions related to the address type */
NatSpecMultiLine
sendValue
function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); // solhint-disable-next-line avoid-low-level-calls, avoid-call-value (bool success, ) = recipient.call{ value: amount }(""); require(success, "Address: unable to send value, recipient may have reverted"); }
/** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */
NatSpecMultiLine
v0.6.6+commit.6c089d02
MIT
ipfs://75e0826307cea4fcdb14e513c28c765678b11bf94c772e7638ae18889c1108e1
{ "func_code_index": [ 2160, 2562 ] }
2,012
HatAirdrop
HatAirdrop.sol
0x63f28989cca095e61b1dc74050e6132eeb4cb7c3
Solidity
Address
library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== */ function isContract(address account) internal view returns (bool) { // According to EIP-1052, 0x0 is the value returned for not-yet created accounts // and 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470 is returned // for accounts without code, i.e. `keccak256('')` bytes32 codehash; bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470; // solhint-disable-next-line no-inline-assembly assembly { codehash := extcodehash(account) } return (codehash != accountHash && codehash != 0x0); } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); // solhint-disable-next-line avoid-low-level-calls, avoid-call-value (bool success, ) = recipient.call{ value: amount }(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain`call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCall(target, data, "Address: low-level call failed"); } /** * @dev Same as {Address-functionCall-address-bytes-}, but with * `errorMessage` as a fallback revert reason when `target` reverts. */ function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) { return _functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Performs a Solidity function call using a low level `call`, * transferring `value` wei. A plain`call` is an unsafe replacement for a * function call: use this function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Requirements: * * - `target` must be a contract. * - the calling contract must have an ETH balance of at least `value`. * - calling `target` with `data` must not revert. */ function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {Address-functionCallWithValue-address-bytes-uint256-}, but * with `errorMessage` as a fallback revert reason when `target` reverts. */ function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); return _functionCallWithValue(target, data, value, errorMessage); } function _functionCallWithValue(address target, bytes memory data, uint256 weiValue, string memory errorMessage) private returns (bytes memory) { require(isContract(target), "Address: call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.call{ value: weiValue }(data); if (success) { return returndata; } else { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly // solhint-disable-next-line no-inline-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } }
/** * @dev Collection of functions related to the address type */
NatSpecMultiLine
functionCall
function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCall(target, data, "Address: low-level call failed"); }
/** * @dev Performs a Solidity function call using a low level `call`. A * plain`call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. */
NatSpecMultiLine
v0.6.6+commit.6c089d02
MIT
ipfs://75e0826307cea4fcdb14e513c28c765678b11bf94c772e7638ae18889c1108e1
{ "func_code_index": [ 3032, 3210 ] }
2,013
HatAirdrop
HatAirdrop.sol
0x63f28989cca095e61b1dc74050e6132eeb4cb7c3
Solidity
Address
library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== */ function isContract(address account) internal view returns (bool) { // According to EIP-1052, 0x0 is the value returned for not-yet created accounts // and 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470 is returned // for accounts without code, i.e. `keccak256('')` bytes32 codehash; bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470; // solhint-disable-next-line no-inline-assembly assembly { codehash := extcodehash(account) } return (codehash != accountHash && codehash != 0x0); } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); // solhint-disable-next-line avoid-low-level-calls, avoid-call-value (bool success, ) = recipient.call{ value: amount }(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain`call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCall(target, data, "Address: low-level call failed"); } /** * @dev Same as {Address-functionCall-address-bytes-}, but with * `errorMessage` as a fallback revert reason when `target` reverts. */ function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) { return _functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Performs a Solidity function call using a low level `call`, * transferring `value` wei. A plain`call` is an unsafe replacement for a * function call: use this function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Requirements: * * - `target` must be a contract. * - the calling contract must have an ETH balance of at least `value`. * - calling `target` with `data` must not revert. */ function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {Address-functionCallWithValue-address-bytes-uint256-}, but * with `errorMessage` as a fallback revert reason when `target` reverts. */ function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); return _functionCallWithValue(target, data, value, errorMessage); } function _functionCallWithValue(address target, bytes memory data, uint256 weiValue, string memory errorMessage) private returns (bytes memory) { require(isContract(target), "Address: call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.call{ value: weiValue }(data); if (success) { return returndata; } else { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly // solhint-disable-next-line no-inline-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } }
/** * @dev Collection of functions related to the address type */
NatSpecMultiLine
functionCall
function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) { return _functionCallWithValue(target, data, 0, errorMessage); }
/** * @dev Same as {Address-functionCall-address-bytes-}, but with * `errorMessage` as a fallback revert reason when `target` reverts. */
NatSpecMultiLine
v0.6.6+commit.6c089d02
MIT
ipfs://75e0826307cea4fcdb14e513c28c765678b11bf94c772e7638ae18889c1108e1
{ "func_code_index": [ 3374, 3575 ] }
2,014
HatAirdrop
HatAirdrop.sol
0x63f28989cca095e61b1dc74050e6132eeb4cb7c3
Solidity
Address
library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== */ function isContract(address account) internal view returns (bool) { // According to EIP-1052, 0x0 is the value returned for not-yet created accounts // and 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470 is returned // for accounts without code, i.e. `keccak256('')` bytes32 codehash; bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470; // solhint-disable-next-line no-inline-assembly assembly { codehash := extcodehash(account) } return (codehash != accountHash && codehash != 0x0); } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); // solhint-disable-next-line avoid-low-level-calls, avoid-call-value (bool success, ) = recipient.call{ value: amount }(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain`call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCall(target, data, "Address: low-level call failed"); } /** * @dev Same as {Address-functionCall-address-bytes-}, but with * `errorMessage` as a fallback revert reason when `target` reverts. */ function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) { return _functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Performs a Solidity function call using a low level `call`, * transferring `value` wei. A plain`call` is an unsafe replacement for a * function call: use this function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Requirements: * * - `target` must be a contract. * - the calling contract must have an ETH balance of at least `value`. * - calling `target` with `data` must not revert. */ function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {Address-functionCallWithValue-address-bytes-uint256-}, but * with `errorMessage` as a fallback revert reason when `target` reverts. */ function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); return _functionCallWithValue(target, data, value, errorMessage); } function _functionCallWithValue(address target, bytes memory data, uint256 weiValue, string memory errorMessage) private returns (bytes memory) { require(isContract(target), "Address: call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.call{ value: weiValue }(data); if (success) { return returndata; } else { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly // solhint-disable-next-line no-inline-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } }
/** * @dev Collection of functions related to the address type */
NatSpecMultiLine
functionCallWithValue
function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); }
/** * @dev Performs a Solidity function call using a low level `call`, * transferring `value` wei. A plain`call` is an unsafe replacement for a * function call: use this function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Requirements: * * - `target` must be a contract. * - the calling contract must have an ETH balance of at least `value`. * - calling `target` with `data` must not revert. */
NatSpecMultiLine
v0.6.6+commit.6c089d02
MIT
ipfs://75e0826307cea4fcdb14e513c28c765678b11bf94c772e7638ae18889c1108e1
{ "func_code_index": [ 4148, 4379 ] }
2,015
HatAirdrop
HatAirdrop.sol
0x63f28989cca095e61b1dc74050e6132eeb4cb7c3
Solidity
Address
library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== */ function isContract(address account) internal view returns (bool) { // According to EIP-1052, 0x0 is the value returned for not-yet created accounts // and 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470 is returned // for accounts without code, i.e. `keccak256('')` bytes32 codehash; bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470; // solhint-disable-next-line no-inline-assembly assembly { codehash := extcodehash(account) } return (codehash != accountHash && codehash != 0x0); } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); // solhint-disable-next-line avoid-low-level-calls, avoid-call-value (bool success, ) = recipient.call{ value: amount }(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain`call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCall(target, data, "Address: low-level call failed"); } /** * @dev Same as {Address-functionCall-address-bytes-}, but with * `errorMessage` as a fallback revert reason when `target` reverts. */ function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) { return _functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Performs a Solidity function call using a low level `call`, * transferring `value` wei. A plain`call` is an unsafe replacement for a * function call: use this function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Requirements: * * - `target` must be a contract. * - the calling contract must have an ETH balance of at least `value`. * - calling `target` with `data` must not revert. */ function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {Address-functionCallWithValue-address-bytes-uint256-}, but * with `errorMessage` as a fallback revert reason when `target` reverts. */ function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); return _functionCallWithValue(target, data, value, errorMessage); } function _functionCallWithValue(address target, bytes memory data, uint256 weiValue, string memory errorMessage) private returns (bytes memory) { require(isContract(target), "Address: call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.call{ value: weiValue }(data); if (success) { return returndata; } else { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly // solhint-disable-next-line no-inline-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } }
/** * @dev Collection of functions related to the address type */
NatSpecMultiLine
functionCallWithValue
function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); return _functionCallWithValue(target, data, value, errorMessage); }
/** * @dev Same as {Address-functionCallWithValue-address-bytes-uint256-}, but * with `errorMessage` as a fallback revert reason when `target` reverts. */
NatSpecMultiLine
v0.6.6+commit.6c089d02
MIT
ipfs://75e0826307cea4fcdb14e513c28c765678b11bf94c772e7638ae18889c1108e1
{ "func_code_index": [ 4560, 4881 ] }
2,016
HatAirdrop
HatAirdrop.sol
0x63f28989cca095e61b1dc74050e6132eeb4cb7c3
Solidity
IERC20
interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `recipient`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address recipient, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `sender` to `recipient` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom(address sender, address recipient, uint256 amount) external returns (bool); /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); }
/** * @dev Interface of the ERC20 standard as defined in the EIP. */
NatSpecMultiLine
totalSupply
function totalSupply() external view returns (uint256);
/** * @dev Returns the amount of tokens in existence. */
NatSpecMultiLine
v0.6.6+commit.6c089d02
MIT
ipfs://75e0826307cea4fcdb14e513c28c765678b11bf94c772e7638ae18889c1108e1
{ "func_code_index": [ 94, 154 ] }
2,017
HatAirdrop
HatAirdrop.sol
0x63f28989cca095e61b1dc74050e6132eeb4cb7c3
Solidity
IERC20
interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `recipient`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address recipient, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `sender` to `recipient` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom(address sender, address recipient, uint256 amount) external returns (bool); /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); }
/** * @dev Interface of the ERC20 standard as defined in the EIP. */
NatSpecMultiLine
balanceOf
function balanceOf(address account) external view returns (uint256);
/** * @dev Returns the amount of tokens owned by `account`. */
NatSpecMultiLine
v0.6.6+commit.6c089d02
MIT
ipfs://75e0826307cea4fcdb14e513c28c765678b11bf94c772e7638ae18889c1108e1
{ "func_code_index": [ 237, 310 ] }
2,018
HatAirdrop
HatAirdrop.sol
0x63f28989cca095e61b1dc74050e6132eeb4cb7c3
Solidity
IERC20
interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `recipient`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address recipient, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `sender` to `recipient` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom(address sender, address recipient, uint256 amount) external returns (bool); /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); }
/** * @dev Interface of the ERC20 standard as defined in the EIP. */
NatSpecMultiLine
transfer
function transfer(address recipient, uint256 amount) external returns (bool);
/** * @dev Moves `amount` tokens from the caller's account to `recipient`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */
NatSpecMultiLine
v0.6.6+commit.6c089d02
MIT
ipfs://75e0826307cea4fcdb14e513c28c765678b11bf94c772e7638ae18889c1108e1
{ "func_code_index": [ 534, 616 ] }
2,019
HatAirdrop
HatAirdrop.sol
0x63f28989cca095e61b1dc74050e6132eeb4cb7c3
Solidity
IERC20
interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `recipient`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address recipient, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `sender` to `recipient` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom(address sender, address recipient, uint256 amount) external returns (bool); /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); }
/** * @dev Interface of the ERC20 standard as defined in the EIP. */
NatSpecMultiLine
allowance
function allowance(address owner, address spender) external view returns (uint256);
/** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */
NatSpecMultiLine
v0.6.6+commit.6c089d02
MIT
ipfs://75e0826307cea4fcdb14e513c28c765678b11bf94c772e7638ae18889c1108e1
{ "func_code_index": [ 895, 983 ] }
2,020
HatAirdrop
HatAirdrop.sol
0x63f28989cca095e61b1dc74050e6132eeb4cb7c3
Solidity
IERC20
interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `recipient`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address recipient, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `sender` to `recipient` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom(address sender, address recipient, uint256 amount) external returns (bool); /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); }
/** * @dev Interface of the ERC20 standard as defined in the EIP. */
NatSpecMultiLine
approve
function approve(address spender, uint256 amount) external returns (bool);
/** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */
NatSpecMultiLine
v0.6.6+commit.6c089d02
MIT
ipfs://75e0826307cea4fcdb14e513c28c765678b11bf94c772e7638ae18889c1108e1
{ "func_code_index": [ 1647, 1726 ] }
2,021
HatAirdrop
HatAirdrop.sol
0x63f28989cca095e61b1dc74050e6132eeb4cb7c3
Solidity
IERC20
interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `recipient`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address recipient, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `sender` to `recipient` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom(address sender, address recipient, uint256 amount) external returns (bool); /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); }
/** * @dev Interface of the ERC20 standard as defined in the EIP. */
NatSpecMultiLine
transferFrom
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
/** * @dev Moves `amount` tokens from `sender` to `recipient` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */
NatSpecMultiLine
v0.6.6+commit.6c089d02
MIT
ipfs://75e0826307cea4fcdb14e513c28c765678b11bf94c772e7638ae18889c1108e1
{ "func_code_index": [ 2039, 2141 ] }
2,022
HatAirdrop
HatAirdrop.sol
0x63f28989cca095e61b1dc74050e6132eeb4cb7c3
Solidity
SafeMath
library SafeMath { /** * @dev Returns the addition of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `+` operator. * * Requirements: * * - Addition cannot overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; require(c >= a, "SafeMath: addition overflow"); return c; } /** * @dev Returns the subtraction of two unsigned integers, reverting on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { return sub(a, b, "SafeMath: subtraction overflow"); } /** * @dev Returns the subtraction of two unsigned integers, reverting with custom message on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b <= a, errorMessage); uint256 c = a - b; return c; } /** * @dev Returns the multiplication of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `*` operator. * * Requirements: * * - Multiplication cannot overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522 if (a == 0) { return 0; } uint256 c = a * b; require(c / a == b, "SafeMath: multiplication overflow"); return c; } /** * @dev Returns the integer division of two unsigned integers. Reverts on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { return div(a, b, "SafeMath: division by zero"); } /** * @dev Returns the integer division of two unsigned integers. Reverts with custom message on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b > 0, errorMessage); uint256 c = a / b; // assert(a == b * c + a % b); // There is no case in which this doesn't hold return c; } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * Reverts when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b) internal pure returns (uint256) { return mod(a, b, "SafeMath: modulo by zero"); } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * Reverts with custom message when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b != 0, errorMessage); return a % b; } }
/** * @dev Wrappers over Solidity's arithmetic operations with added overflow * checks. * * Arithmetic operations in Solidity wrap on overflow. This can easily result * in bugs, because programmers usually assume that an overflow raises an * error, which is the standard behavior in high level programming languages. * `SafeMath` restores this intuition by reverting the transaction when an * operation overflows. * * Using this library instead of the unchecked operations eliminates an entire * class of bugs, so it's recommended to use it always. */
NatSpecMultiLine
add
function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; require(c >= a, "SafeMath: addition overflow"); return c; }
/** * @dev Returns the addition of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `+` operator. * * Requirements: * * - Addition cannot overflow. */
NatSpecMultiLine
v0.6.6+commit.6c089d02
MIT
ipfs://75e0826307cea4fcdb14e513c28c765678b11bf94c772e7638ae18889c1108e1
{ "func_code_index": [ 259, 445 ] }
2,023
HatAirdrop
HatAirdrop.sol
0x63f28989cca095e61b1dc74050e6132eeb4cb7c3
Solidity
SafeMath
library SafeMath { /** * @dev Returns the addition of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `+` operator. * * Requirements: * * - Addition cannot overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; require(c >= a, "SafeMath: addition overflow"); return c; } /** * @dev Returns the subtraction of two unsigned integers, reverting on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { return sub(a, b, "SafeMath: subtraction overflow"); } /** * @dev Returns the subtraction of two unsigned integers, reverting with custom message on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b <= a, errorMessage); uint256 c = a - b; return c; } /** * @dev Returns the multiplication of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `*` operator. * * Requirements: * * - Multiplication cannot overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522 if (a == 0) { return 0; } uint256 c = a * b; require(c / a == b, "SafeMath: multiplication overflow"); return c; } /** * @dev Returns the integer division of two unsigned integers. Reverts on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { return div(a, b, "SafeMath: division by zero"); } /** * @dev Returns the integer division of two unsigned integers. Reverts with custom message on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b > 0, errorMessage); uint256 c = a / b; // assert(a == b * c + a % b); // There is no case in which this doesn't hold return c; } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * Reverts when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b) internal pure returns (uint256) { return mod(a, b, "SafeMath: modulo by zero"); } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * Reverts with custom message when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b != 0, errorMessage); return a % b; } }
/** * @dev Wrappers over Solidity's arithmetic operations with added overflow * checks. * * Arithmetic operations in Solidity wrap on overflow. This can easily result * in bugs, because programmers usually assume that an overflow raises an * error, which is the standard behavior in high level programming languages. * `SafeMath` restores this intuition by reverting the transaction when an * operation overflows. * * Using this library instead of the unchecked operations eliminates an entire * class of bugs, so it's recommended to use it always. */
NatSpecMultiLine
sub
function sub(uint256 a, uint256 b) internal pure returns (uint256) { return sub(a, b, "SafeMath: subtraction overflow"); }
/** * @dev Returns the subtraction of two unsigned integers, reverting on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */
NatSpecMultiLine
v0.6.6+commit.6c089d02
MIT
ipfs://75e0826307cea4fcdb14e513c28c765678b11bf94c772e7638ae18889c1108e1
{ "func_code_index": [ 723, 864 ] }
2,024
HatAirdrop
HatAirdrop.sol
0x63f28989cca095e61b1dc74050e6132eeb4cb7c3
Solidity
SafeMath
library SafeMath { /** * @dev Returns the addition of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `+` operator. * * Requirements: * * - Addition cannot overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; require(c >= a, "SafeMath: addition overflow"); return c; } /** * @dev Returns the subtraction of two unsigned integers, reverting on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { return sub(a, b, "SafeMath: subtraction overflow"); } /** * @dev Returns the subtraction of two unsigned integers, reverting with custom message on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b <= a, errorMessage); uint256 c = a - b; return c; } /** * @dev Returns the multiplication of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `*` operator. * * Requirements: * * - Multiplication cannot overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522 if (a == 0) { return 0; } uint256 c = a * b; require(c / a == b, "SafeMath: multiplication overflow"); return c; } /** * @dev Returns the integer division of two unsigned integers. Reverts on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { return div(a, b, "SafeMath: division by zero"); } /** * @dev Returns the integer division of two unsigned integers. Reverts with custom message on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b > 0, errorMessage); uint256 c = a / b; // assert(a == b * c + a % b); // There is no case in which this doesn't hold return c; } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * Reverts when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b) internal pure returns (uint256) { return mod(a, b, "SafeMath: modulo by zero"); } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * Reverts with custom message when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b != 0, errorMessage); return a % b; } }
/** * @dev Wrappers over Solidity's arithmetic operations with added overflow * checks. * * Arithmetic operations in Solidity wrap on overflow. This can easily result * in bugs, because programmers usually assume that an overflow raises an * error, which is the standard behavior in high level programming languages. * `SafeMath` restores this intuition by reverting the transaction when an * operation overflows. * * Using this library instead of the unchecked operations eliminates an entire * class of bugs, so it's recommended to use it always. */
NatSpecMultiLine
sub
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b <= a, errorMessage); uint256 c = a - b; return c; }
/** * @dev Returns the subtraction of two unsigned integers, reverting with custom message on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */
NatSpecMultiLine
v0.6.6+commit.6c089d02
MIT
ipfs://75e0826307cea4fcdb14e513c28c765678b11bf94c772e7638ae18889c1108e1
{ "func_code_index": [ 1162, 1359 ] }
2,025
HatAirdrop
HatAirdrop.sol
0x63f28989cca095e61b1dc74050e6132eeb4cb7c3
Solidity
SafeMath
library SafeMath { /** * @dev Returns the addition of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `+` operator. * * Requirements: * * - Addition cannot overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; require(c >= a, "SafeMath: addition overflow"); return c; } /** * @dev Returns the subtraction of two unsigned integers, reverting on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { return sub(a, b, "SafeMath: subtraction overflow"); } /** * @dev Returns the subtraction of two unsigned integers, reverting with custom message on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b <= a, errorMessage); uint256 c = a - b; return c; } /** * @dev Returns the multiplication of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `*` operator. * * Requirements: * * - Multiplication cannot overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522 if (a == 0) { return 0; } uint256 c = a * b; require(c / a == b, "SafeMath: multiplication overflow"); return c; } /** * @dev Returns the integer division of two unsigned integers. Reverts on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { return div(a, b, "SafeMath: division by zero"); } /** * @dev Returns the integer division of two unsigned integers. Reverts with custom message on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b > 0, errorMessage); uint256 c = a / b; // assert(a == b * c + a % b); // There is no case in which this doesn't hold return c; } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * Reverts when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b) internal pure returns (uint256) { return mod(a, b, "SafeMath: modulo by zero"); } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * Reverts with custom message when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b != 0, errorMessage); return a % b; } }
/** * @dev Wrappers over Solidity's arithmetic operations with added overflow * checks. * * Arithmetic operations in Solidity wrap on overflow. This can easily result * in bugs, because programmers usually assume that an overflow raises an * error, which is the standard behavior in high level programming languages. * `SafeMath` restores this intuition by reverting the transaction when an * operation overflows. * * Using this library instead of the unchecked operations eliminates an entire * class of bugs, so it's recommended to use it always. */
NatSpecMultiLine
mul
function mul(uint256 a, uint256 b) internal pure returns (uint256) { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522 if (a == 0) { return 0; } uint256 c = a * b; require(c / a == b, "SafeMath: multiplication overflow"); return c; }
/** * @dev Returns the multiplication of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `*` operator. * * Requirements: * * - Multiplication cannot overflow. */
NatSpecMultiLine
v0.6.6+commit.6c089d02
MIT
ipfs://75e0826307cea4fcdb14e513c28c765678b11bf94c772e7638ae18889c1108e1
{ "func_code_index": [ 1613, 2089 ] }
2,026
HatAirdrop
HatAirdrop.sol
0x63f28989cca095e61b1dc74050e6132eeb4cb7c3
Solidity
SafeMath
library SafeMath { /** * @dev Returns the addition of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `+` operator. * * Requirements: * * - Addition cannot overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; require(c >= a, "SafeMath: addition overflow"); return c; } /** * @dev Returns the subtraction of two unsigned integers, reverting on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { return sub(a, b, "SafeMath: subtraction overflow"); } /** * @dev Returns the subtraction of two unsigned integers, reverting with custom message on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b <= a, errorMessage); uint256 c = a - b; return c; } /** * @dev Returns the multiplication of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `*` operator. * * Requirements: * * - Multiplication cannot overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522 if (a == 0) { return 0; } uint256 c = a * b; require(c / a == b, "SafeMath: multiplication overflow"); return c; } /** * @dev Returns the integer division of two unsigned integers. Reverts on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { return div(a, b, "SafeMath: division by zero"); } /** * @dev Returns the integer division of two unsigned integers. Reverts with custom message on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b > 0, errorMessage); uint256 c = a / b; // assert(a == b * c + a % b); // There is no case in which this doesn't hold return c; } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * Reverts when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b) internal pure returns (uint256) { return mod(a, b, "SafeMath: modulo by zero"); } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * Reverts with custom message when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b != 0, errorMessage); return a % b; } }
/** * @dev Wrappers over Solidity's arithmetic operations with added overflow * checks. * * Arithmetic operations in Solidity wrap on overflow. This can easily result * in bugs, because programmers usually assume that an overflow raises an * error, which is the standard behavior in high level programming languages. * `SafeMath` restores this intuition by reverting the transaction when an * operation overflows. * * Using this library instead of the unchecked operations eliminates an entire * class of bugs, so it's recommended to use it always. */
NatSpecMultiLine
div
function div(uint256 a, uint256 b) internal pure returns (uint256) { return div(a, b, "SafeMath: division by zero"); }
/** * @dev Returns the integer division of two unsigned integers. Reverts on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */
NatSpecMultiLine
v0.6.6+commit.6c089d02
MIT
ipfs://75e0826307cea4fcdb14e513c28c765678b11bf94c772e7638ae18889c1108e1
{ "func_code_index": [ 2560, 2697 ] }
2,027
HatAirdrop
HatAirdrop.sol
0x63f28989cca095e61b1dc74050e6132eeb4cb7c3
Solidity
SafeMath
library SafeMath { /** * @dev Returns the addition of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `+` operator. * * Requirements: * * - Addition cannot overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; require(c >= a, "SafeMath: addition overflow"); return c; } /** * @dev Returns the subtraction of two unsigned integers, reverting on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { return sub(a, b, "SafeMath: subtraction overflow"); } /** * @dev Returns the subtraction of two unsigned integers, reverting with custom message on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b <= a, errorMessage); uint256 c = a - b; return c; } /** * @dev Returns the multiplication of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `*` operator. * * Requirements: * * - Multiplication cannot overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522 if (a == 0) { return 0; } uint256 c = a * b; require(c / a == b, "SafeMath: multiplication overflow"); return c; } /** * @dev Returns the integer division of two unsigned integers. Reverts on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { return div(a, b, "SafeMath: division by zero"); } /** * @dev Returns the integer division of two unsigned integers. Reverts with custom message on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b > 0, errorMessage); uint256 c = a / b; // assert(a == b * c + a % b); // There is no case in which this doesn't hold return c; } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * Reverts when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b) internal pure returns (uint256) { return mod(a, b, "SafeMath: modulo by zero"); } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * Reverts with custom message when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b != 0, errorMessage); return a % b; } }
/** * @dev Wrappers over Solidity's arithmetic operations with added overflow * checks. * * Arithmetic operations in Solidity wrap on overflow. This can easily result * in bugs, because programmers usually assume that an overflow raises an * error, which is the standard behavior in high level programming languages. * `SafeMath` restores this intuition by reverting the transaction when an * operation overflows. * * Using this library instead of the unchecked operations eliminates an entire * class of bugs, so it's recommended to use it always. */
NatSpecMultiLine
div
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b > 0, errorMessage); uint256 c = a / b; // assert(a == b * c + a % b); // There is no case in which this doesn't hold return c; }
/** * @dev Returns the integer division of two unsigned integers. Reverts with custom message on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */
NatSpecMultiLine
v0.6.6+commit.6c089d02
MIT
ipfs://75e0826307cea4fcdb14e513c28c765678b11bf94c772e7638ae18889c1108e1
{ "func_code_index": [ 3188, 3471 ] }
2,028
HatAirdrop
HatAirdrop.sol
0x63f28989cca095e61b1dc74050e6132eeb4cb7c3
Solidity
SafeMath
library SafeMath { /** * @dev Returns the addition of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `+` operator. * * Requirements: * * - Addition cannot overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; require(c >= a, "SafeMath: addition overflow"); return c; } /** * @dev Returns the subtraction of two unsigned integers, reverting on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { return sub(a, b, "SafeMath: subtraction overflow"); } /** * @dev Returns the subtraction of two unsigned integers, reverting with custom message on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b <= a, errorMessage); uint256 c = a - b; return c; } /** * @dev Returns the multiplication of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `*` operator. * * Requirements: * * - Multiplication cannot overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522 if (a == 0) { return 0; } uint256 c = a * b; require(c / a == b, "SafeMath: multiplication overflow"); return c; } /** * @dev Returns the integer division of two unsigned integers. Reverts on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { return div(a, b, "SafeMath: division by zero"); } /** * @dev Returns the integer division of two unsigned integers. Reverts with custom message on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b > 0, errorMessage); uint256 c = a / b; // assert(a == b * c + a % b); // There is no case in which this doesn't hold return c; } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * Reverts when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b) internal pure returns (uint256) { return mod(a, b, "SafeMath: modulo by zero"); } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * Reverts with custom message when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b != 0, errorMessage); return a % b; } }
/** * @dev Wrappers over Solidity's arithmetic operations with added overflow * checks. * * Arithmetic operations in Solidity wrap on overflow. This can easily result * in bugs, because programmers usually assume that an overflow raises an * error, which is the standard behavior in high level programming languages. * `SafeMath` restores this intuition by reverting the transaction when an * operation overflows. * * Using this library instead of the unchecked operations eliminates an entire * class of bugs, so it's recommended to use it always. */
NatSpecMultiLine
mod
function mod(uint256 a, uint256 b) internal pure returns (uint256) { return mod(a, b, "SafeMath: modulo by zero"); }
/** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * Reverts when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */
NatSpecMultiLine
v0.6.6+commit.6c089d02
MIT
ipfs://75e0826307cea4fcdb14e513c28c765678b11bf94c772e7638ae18889c1108e1
{ "func_code_index": [ 3931, 4066 ] }
2,029
HatAirdrop
HatAirdrop.sol
0x63f28989cca095e61b1dc74050e6132eeb4cb7c3
Solidity
SafeMath
library SafeMath { /** * @dev Returns the addition of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `+` operator. * * Requirements: * * - Addition cannot overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; require(c >= a, "SafeMath: addition overflow"); return c; } /** * @dev Returns the subtraction of two unsigned integers, reverting on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { return sub(a, b, "SafeMath: subtraction overflow"); } /** * @dev Returns the subtraction of two unsigned integers, reverting with custom message on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b <= a, errorMessage); uint256 c = a - b; return c; } /** * @dev Returns the multiplication of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `*` operator. * * Requirements: * * - Multiplication cannot overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522 if (a == 0) { return 0; } uint256 c = a * b; require(c / a == b, "SafeMath: multiplication overflow"); return c; } /** * @dev Returns the integer division of two unsigned integers. Reverts on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { return div(a, b, "SafeMath: division by zero"); } /** * @dev Returns the integer division of two unsigned integers. Reverts with custom message on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b > 0, errorMessage); uint256 c = a / b; // assert(a == b * c + a % b); // There is no case in which this doesn't hold return c; } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * Reverts when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b) internal pure returns (uint256) { return mod(a, b, "SafeMath: modulo by zero"); } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * Reverts with custom message when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b != 0, errorMessage); return a % b; } }
/** * @dev Wrappers over Solidity's arithmetic operations with added overflow * checks. * * Arithmetic operations in Solidity wrap on overflow. This can easily result * in bugs, because programmers usually assume that an overflow raises an * error, which is the standard behavior in high level programming languages. * `SafeMath` restores this intuition by reverting the transaction when an * operation overflows. * * Using this library instead of the unchecked operations eliminates an entire * class of bugs, so it's recommended to use it always. */
NatSpecMultiLine
mod
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b != 0, errorMessage); return a % b; }
/** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * Reverts with custom message when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */
NatSpecMultiLine
v0.6.6+commit.6c089d02
MIT
ipfs://75e0826307cea4fcdb14e513c28c765678b11bf94c772e7638ae18889c1108e1
{ "func_code_index": [ 4546, 4717 ] }
2,030
HatAirdrop
HatAirdrop.sol
0x63f28989cca095e61b1dc74050e6132eeb4cb7c3
Solidity
SafeERC20
library SafeERC20 { using SafeMath for uint256; using Address for address; function safeTransfer(IERC20 token, address to, uint256 value) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value)); } function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value)); } /** * @dev Deprecated. This function has issues similar to the ones found in * {IERC20-approve}, and its usage is discouraged. * * Whenever possible, use {safeIncreaseAllowance} and * {safeDecreaseAllowance} instead. */ function safeApprove(IERC20 token, address spender, uint256 value) internal { // safeApprove should only be called when setting an initial allowance, // or when resetting it to zero. To increase and decrease it, use // 'safeIncreaseAllowance' and 'safeDecreaseAllowance' // solhint-disable-next-line max-line-length require((value == 0) || (token.allowance(address(this), spender) == 0), "SafeERC20: approve from non-zero to non-zero allowance" ); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value)); } function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal { uint256 newAllowance = token.allowance(address(this), spender).add(value); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal { uint256 newAllowance = token.allowance(address(this), spender).sub(value, "SafeERC20: decreased allowance below zero"); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } /** * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement * on the return value: the return value is optional (but if data is returned, it must not be false). * @param token The token targeted by the call. * @param data The call data (encoded using abi.encode or one of its variants). */ function _callOptionalReturn(IERC20 token, bytes memory data) private { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that // the target address contains contract code and also asserts for success in the low-level call. bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed"); if (returndata.length > 0) { // Return data is optional // solhint-disable-next-line max-line-length require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed"); } } }
/** * @title SafeERC20 * @dev Wrappers around ERC20 operations that throw on failure (when the token * contract returns false). Tokens that return no value (and instead revert or * throw on failure) are also supported, non-reverting calls are assumed to be * successful. * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract, * which allows you to call the safe operations as `token.safeTransfer(...)`, etc. */
NatSpecMultiLine
safeApprove
function safeApprove(IERC20 token, address spender, uint256 value) internal { // safeApprove should only be called when setting an initial allowance, // or when resetting it to zero. To increase and decrease it, use // 'safeIncreaseAllowance' and 'safeDecreaseAllowance' // solhint-disable-next-line max-line-length require((value == 0) || (token.allowance(address(this), spender) == 0), "SafeERC20: approve from non-zero to non-zero allowance" ); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value)); }
/** * @dev Deprecated. This function has issues similar to the ones found in * {IERC20-approve}, and its usage is discouraged. * * Whenever possible, use {safeIncreaseAllowance} and * {safeDecreaseAllowance} instead. */
NatSpecMultiLine
v0.6.6+commit.6c089d02
MIT
ipfs://75e0826307cea4fcdb14e513c28c765678b11bf94c772e7638ae18889c1108e1
{ "func_code_index": [ 747, 1374 ] }
2,031
HatAirdrop
HatAirdrop.sol
0x63f28989cca095e61b1dc74050e6132eeb4cb7c3
Solidity
SafeERC20
library SafeERC20 { using SafeMath for uint256; using Address for address; function safeTransfer(IERC20 token, address to, uint256 value) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value)); } function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value)); } /** * @dev Deprecated. This function has issues similar to the ones found in * {IERC20-approve}, and its usage is discouraged. * * Whenever possible, use {safeIncreaseAllowance} and * {safeDecreaseAllowance} instead. */ function safeApprove(IERC20 token, address spender, uint256 value) internal { // safeApprove should only be called when setting an initial allowance, // or when resetting it to zero. To increase and decrease it, use // 'safeIncreaseAllowance' and 'safeDecreaseAllowance' // solhint-disable-next-line max-line-length require((value == 0) || (token.allowance(address(this), spender) == 0), "SafeERC20: approve from non-zero to non-zero allowance" ); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value)); } function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal { uint256 newAllowance = token.allowance(address(this), spender).add(value); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal { uint256 newAllowance = token.allowance(address(this), spender).sub(value, "SafeERC20: decreased allowance below zero"); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } /** * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement * on the return value: the return value is optional (but if data is returned, it must not be false). * @param token The token targeted by the call. * @param data The call data (encoded using abi.encode or one of its variants). */ function _callOptionalReturn(IERC20 token, bytes memory data) private { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that // the target address contains contract code and also asserts for success in the low-level call. bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed"); if (returndata.length > 0) { // Return data is optional // solhint-disable-next-line max-line-length require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed"); } } }
/** * @title SafeERC20 * @dev Wrappers around ERC20 operations that throw on failure (when the token * contract returns false). Tokens that return no value (and instead revert or * throw on failure) are also supported, non-reverting calls are assumed to be * successful. * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract, * which allows you to call the safe operations as `token.safeTransfer(...)`, etc. */
NatSpecMultiLine
_callOptionalReturn
function _callOptionalReturn(IERC20 token, bytes memory data) private { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that // the target address contains contract code and also asserts for success in the low-level call. bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed"); if (returndata.length > 0) { // Return data is optional // solhint-disable-next-line max-line-length require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed"); } }
/** * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement * on the return value: the return value is optional (but if data is returned, it must not be false). * @param token The token targeted by the call. * @param data The call data (encoded using abi.encode or one of its variants). */
NatSpecMultiLine
v0.6.6+commit.6c089d02
MIT
ipfs://75e0826307cea4fcdb14e513c28c765678b11bf94c772e7638ae18889c1108e1
{ "func_code_index": [ 2393, 3159 ] }
2,032
HatAirdrop
HatAirdrop.sol
0x63f28989cca095e61b1dc74050e6132eeb4cb7c3
Solidity
Ownable
contract Ownable is Context { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor () internal { address msgSender = _msgSender(); _owner = msgSender; emit OwnershipTransferred(address(0), msgSender); } /** * @dev Returns the address of the current owner. */ function owner() public view returns (address) { return _owner; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(_owner == _msgSender(), "Ownable: caller is not the owner"); _; } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { emit OwnershipTransferred(_owner, address(0)); _owner = address(0); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { require(newOwner != address(0), "Ownable: new owner is the zero address"); emit OwnershipTransferred(_owner, newOwner); _owner = newOwner; } }
/** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * By default, the owner account will be the one that deploys the contract. This * can later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */
NatSpecMultiLine
owner
function owner() public view returns (address) { return _owner; }
/** * @dev Returns the address of the current owner. */
NatSpecMultiLine
v0.6.6+commit.6c089d02
MIT
ipfs://75e0826307cea4fcdb14e513c28c765678b11bf94c772e7638ae18889c1108e1
{ "func_code_index": [ 497, 581 ] }
2,033
HatAirdrop
HatAirdrop.sol
0x63f28989cca095e61b1dc74050e6132eeb4cb7c3
Solidity
Ownable
contract Ownable is Context { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor () internal { address msgSender = _msgSender(); _owner = msgSender; emit OwnershipTransferred(address(0), msgSender); } /** * @dev Returns the address of the current owner. */ function owner() public view returns (address) { return _owner; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(_owner == _msgSender(), "Ownable: caller is not the owner"); _; } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { emit OwnershipTransferred(_owner, address(0)); _owner = address(0); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { require(newOwner != address(0), "Ownable: new owner is the zero address"); emit OwnershipTransferred(_owner, newOwner); _owner = newOwner; } }
/** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * By default, the owner account will be the one that deploys the contract. This * can later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */
NatSpecMultiLine
renounceOwnership
function renounceOwnership() public virtual onlyOwner { emit OwnershipTransferred(_owner, address(0)); _owner = address(0); }
/** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */
NatSpecMultiLine
v0.6.6+commit.6c089d02
MIT
ipfs://75e0826307cea4fcdb14e513c28c765678b11bf94c772e7638ae18889c1108e1
{ "func_code_index": [ 1139, 1292 ] }
2,034
HatAirdrop
HatAirdrop.sol
0x63f28989cca095e61b1dc74050e6132eeb4cb7c3
Solidity
Ownable
contract Ownable is Context { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor () internal { address msgSender = _msgSender(); _owner = msgSender; emit OwnershipTransferred(address(0), msgSender); } /** * @dev Returns the address of the current owner. */ function owner() public view returns (address) { return _owner; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(_owner == _msgSender(), "Ownable: caller is not the owner"); _; } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { emit OwnershipTransferred(_owner, address(0)); _owner = address(0); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { require(newOwner != address(0), "Ownable: new owner is the zero address"); emit OwnershipTransferred(_owner, newOwner); _owner = newOwner; } }
/** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * By default, the owner account will be the one that deploys the contract. This * can later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */
NatSpecMultiLine
transferOwnership
function transferOwnership(address newOwner) public virtual onlyOwner { require(newOwner != address(0), "Ownable: new owner is the zero address"); emit OwnershipTransferred(_owner, newOwner); _owner = newOwner; }
/** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */
NatSpecMultiLine
v0.6.6+commit.6c089d02
MIT
ipfs://75e0826307cea4fcdb14e513c28c765678b11bf94c772e7638ae18889c1108e1
{ "func_code_index": [ 1442, 1691 ] }
2,035
CROWED
CROWED.sol
0x7216ae77b12fdcf250caff22b252bdeb3f188e35
Solidity
IERC20
interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `recipient`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address recipient, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `sender` to `recipient` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom(address sender, address recipient, uint256 amount) external returns (bool); /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); }
/** * @dev Interface of the ERC20 standard as defined in the EIP. */
NatSpecMultiLine
totalSupply
function totalSupply() external view returns (uint256);
/** * @dev Returns the amount of tokens in existence. */
NatSpecMultiLine
v0.6.12+commit.27d51765
GNU GPLv2
ipfs://2c46401db6fba9a9044d2a9ef4a783487fdd694901d8f835f40463f41db7374a
{ "func_code_index": [ 94, 154 ] }
2,036
CROWED
CROWED.sol
0x7216ae77b12fdcf250caff22b252bdeb3f188e35
Solidity
IERC20
interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `recipient`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address recipient, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `sender` to `recipient` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom(address sender, address recipient, uint256 amount) external returns (bool); /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); }
/** * @dev Interface of the ERC20 standard as defined in the EIP. */
NatSpecMultiLine
balanceOf
function balanceOf(address account) external view returns (uint256);
/** * @dev Returns the amount of tokens owned by `account`. */
NatSpecMultiLine
v0.6.12+commit.27d51765
GNU GPLv2
ipfs://2c46401db6fba9a9044d2a9ef4a783487fdd694901d8f835f40463f41db7374a
{ "func_code_index": [ 237, 310 ] }
2,037
CROWED
CROWED.sol
0x7216ae77b12fdcf250caff22b252bdeb3f188e35
Solidity
IERC20
interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `recipient`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address recipient, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `sender` to `recipient` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom(address sender, address recipient, uint256 amount) external returns (bool); /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); }
/** * @dev Interface of the ERC20 standard as defined in the EIP. */
NatSpecMultiLine
transfer
function transfer(address recipient, uint256 amount) external returns (bool);
/** * @dev Moves `amount` tokens from the caller's account to `recipient`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */
NatSpecMultiLine
v0.6.12+commit.27d51765
GNU GPLv2
ipfs://2c46401db6fba9a9044d2a9ef4a783487fdd694901d8f835f40463f41db7374a
{ "func_code_index": [ 534, 616 ] }
2,038
CROWED
CROWED.sol
0x7216ae77b12fdcf250caff22b252bdeb3f188e35
Solidity
IERC20
interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `recipient`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address recipient, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `sender` to `recipient` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom(address sender, address recipient, uint256 amount) external returns (bool); /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); }
/** * @dev Interface of the ERC20 standard as defined in the EIP. */
NatSpecMultiLine
allowance
function allowance(address owner, address spender) external view returns (uint256);
/** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */
NatSpecMultiLine
v0.6.12+commit.27d51765
GNU GPLv2
ipfs://2c46401db6fba9a9044d2a9ef4a783487fdd694901d8f835f40463f41db7374a
{ "func_code_index": [ 895, 983 ] }
2,039
CROWED
CROWED.sol
0x7216ae77b12fdcf250caff22b252bdeb3f188e35
Solidity
IERC20
interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `recipient`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address recipient, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `sender` to `recipient` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom(address sender, address recipient, uint256 amount) external returns (bool); /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); }
/** * @dev Interface of the ERC20 standard as defined in the EIP. */
NatSpecMultiLine
approve
function approve(address spender, uint256 amount) external returns (bool);
/** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */
NatSpecMultiLine
v0.6.12+commit.27d51765
GNU GPLv2
ipfs://2c46401db6fba9a9044d2a9ef4a783487fdd694901d8f835f40463f41db7374a
{ "func_code_index": [ 1647, 1726 ] }
2,040
CROWED
CROWED.sol
0x7216ae77b12fdcf250caff22b252bdeb3f188e35
Solidity
IERC20
interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `recipient`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address recipient, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `sender` to `recipient` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom(address sender, address recipient, uint256 amount) external returns (bool); /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); }
/** * @dev Interface of the ERC20 standard as defined in the EIP. */
NatSpecMultiLine
transferFrom
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
/** * @dev Moves `amount` tokens from `sender` to `recipient` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */
NatSpecMultiLine
v0.6.12+commit.27d51765
GNU GPLv2
ipfs://2c46401db6fba9a9044d2a9ef4a783487fdd694901d8f835f40463f41db7374a
{ "func_code_index": [ 2039, 2141 ] }
2,041
CROWED
CROWED.sol
0x7216ae77b12fdcf250caff22b252bdeb3f188e35
Solidity
SafeMath
library SafeMath { /** * @dev Returns the addition of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `+` operator. * * Requirements: * * - Addition cannot overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; require(c >= a, "SafeMath: addition overflow"); return c; } /** * @dev Returns the subtraction of two unsigned integers, reverting on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { return sub(a, b, "SafeMath: subtraction overflow"); } /** * @dev Returns the subtraction of two unsigned integers, reverting with custom message on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b <= a, errorMessage); uint256 c = a - b; return c; } /** * @dev Returns the multiplication of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `*` operator. * * Requirements: * * - Multiplication cannot overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522 if (a == 0) { return 0; } uint256 c = a * b; require(c / a == b, "SafeMath: multiplication overflow"); return c; } /** * @dev Returns the integer division of two unsigned integers. Reverts on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { return div(a, b, "SafeMath: division by zero"); } /** * @dev Returns the integer division of two unsigned integers. Reverts with custom message on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b > 0, errorMessage); uint256 c = a / b; // assert(a == b * c + a % b); // There is no case in which this doesn't hold return c; } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * Reverts when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b) internal pure returns (uint256) { return mod(a, b, "SafeMath: modulo by zero"); } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * Reverts with custom message when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b != 0, errorMessage); return a % b; } }
/** * @dev Wrappers over Solidity's arithmetic operations with added overflow * checks. * * Arithmetic operations in Solidity wrap on overflow. This can easily result * in bugs, because programmers usually assume that an overflow raises an * error, which is the standard behavior in high level programming languages. * `SafeMath` restores this intuition by reverting the transaction when an * operation overflows. * * Using this library instead of the unchecked operations eliminates an entire * class of bugs, so it's recommended to use it always. */
NatSpecMultiLine
add
function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; require(c >= a, "SafeMath: addition overflow"); return c; }
/** * @dev Returns the addition of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `+` operator. * * Requirements: * * - Addition cannot overflow. */
NatSpecMultiLine
v0.6.12+commit.27d51765
GNU GPLv2
ipfs://2c46401db6fba9a9044d2a9ef4a783487fdd694901d8f835f40463f41db7374a
{ "func_code_index": [ 259, 445 ] }
2,042
CROWED
CROWED.sol
0x7216ae77b12fdcf250caff22b252bdeb3f188e35
Solidity
SafeMath
library SafeMath { /** * @dev Returns the addition of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `+` operator. * * Requirements: * * - Addition cannot overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; require(c >= a, "SafeMath: addition overflow"); return c; } /** * @dev Returns the subtraction of two unsigned integers, reverting on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { return sub(a, b, "SafeMath: subtraction overflow"); } /** * @dev Returns the subtraction of two unsigned integers, reverting with custom message on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b <= a, errorMessage); uint256 c = a - b; return c; } /** * @dev Returns the multiplication of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `*` operator. * * Requirements: * * - Multiplication cannot overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522 if (a == 0) { return 0; } uint256 c = a * b; require(c / a == b, "SafeMath: multiplication overflow"); return c; } /** * @dev Returns the integer division of two unsigned integers. Reverts on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { return div(a, b, "SafeMath: division by zero"); } /** * @dev Returns the integer division of two unsigned integers. Reverts with custom message on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b > 0, errorMessage); uint256 c = a / b; // assert(a == b * c + a % b); // There is no case in which this doesn't hold return c; } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * Reverts when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b) internal pure returns (uint256) { return mod(a, b, "SafeMath: modulo by zero"); } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * Reverts with custom message when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b != 0, errorMessage); return a % b; } }
/** * @dev Wrappers over Solidity's arithmetic operations with added overflow * checks. * * Arithmetic operations in Solidity wrap on overflow. This can easily result * in bugs, because programmers usually assume that an overflow raises an * error, which is the standard behavior in high level programming languages. * `SafeMath` restores this intuition by reverting the transaction when an * operation overflows. * * Using this library instead of the unchecked operations eliminates an entire * class of bugs, so it's recommended to use it always. */
NatSpecMultiLine
sub
function sub(uint256 a, uint256 b) internal pure returns (uint256) { return sub(a, b, "SafeMath: subtraction overflow"); }
/** * @dev Returns the subtraction of two unsigned integers, reverting on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */
NatSpecMultiLine
v0.6.12+commit.27d51765
GNU GPLv2
ipfs://2c46401db6fba9a9044d2a9ef4a783487fdd694901d8f835f40463f41db7374a
{ "func_code_index": [ 723, 864 ] }
2,043
CROWED
CROWED.sol
0x7216ae77b12fdcf250caff22b252bdeb3f188e35
Solidity
SafeMath
library SafeMath { /** * @dev Returns the addition of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `+` operator. * * Requirements: * * - Addition cannot overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; require(c >= a, "SafeMath: addition overflow"); return c; } /** * @dev Returns the subtraction of two unsigned integers, reverting on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { return sub(a, b, "SafeMath: subtraction overflow"); } /** * @dev Returns the subtraction of two unsigned integers, reverting with custom message on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b <= a, errorMessage); uint256 c = a - b; return c; } /** * @dev Returns the multiplication of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `*` operator. * * Requirements: * * - Multiplication cannot overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522 if (a == 0) { return 0; } uint256 c = a * b; require(c / a == b, "SafeMath: multiplication overflow"); return c; } /** * @dev Returns the integer division of two unsigned integers. Reverts on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { return div(a, b, "SafeMath: division by zero"); } /** * @dev Returns the integer division of two unsigned integers. Reverts with custom message on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b > 0, errorMessage); uint256 c = a / b; // assert(a == b * c + a % b); // There is no case in which this doesn't hold return c; } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * Reverts when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b) internal pure returns (uint256) { return mod(a, b, "SafeMath: modulo by zero"); } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * Reverts with custom message when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b != 0, errorMessage); return a % b; } }
/** * @dev Wrappers over Solidity's arithmetic operations with added overflow * checks. * * Arithmetic operations in Solidity wrap on overflow. This can easily result * in bugs, because programmers usually assume that an overflow raises an * error, which is the standard behavior in high level programming languages. * `SafeMath` restores this intuition by reverting the transaction when an * operation overflows. * * Using this library instead of the unchecked operations eliminates an entire * class of bugs, so it's recommended to use it always. */
NatSpecMultiLine
sub
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b <= a, errorMessage); uint256 c = a - b; return c; }
/** * @dev Returns the subtraction of two unsigned integers, reverting with custom message on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */
NatSpecMultiLine
v0.6.12+commit.27d51765
GNU GPLv2
ipfs://2c46401db6fba9a9044d2a9ef4a783487fdd694901d8f835f40463f41db7374a
{ "func_code_index": [ 1162, 1359 ] }
2,044
CROWED
CROWED.sol
0x7216ae77b12fdcf250caff22b252bdeb3f188e35
Solidity
SafeMath
library SafeMath { /** * @dev Returns the addition of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `+` operator. * * Requirements: * * - Addition cannot overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; require(c >= a, "SafeMath: addition overflow"); return c; } /** * @dev Returns the subtraction of two unsigned integers, reverting on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { return sub(a, b, "SafeMath: subtraction overflow"); } /** * @dev Returns the subtraction of two unsigned integers, reverting with custom message on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b <= a, errorMessage); uint256 c = a - b; return c; } /** * @dev Returns the multiplication of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `*` operator. * * Requirements: * * - Multiplication cannot overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522 if (a == 0) { return 0; } uint256 c = a * b; require(c / a == b, "SafeMath: multiplication overflow"); return c; } /** * @dev Returns the integer division of two unsigned integers. Reverts on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { return div(a, b, "SafeMath: division by zero"); } /** * @dev Returns the integer division of two unsigned integers. Reverts with custom message on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b > 0, errorMessage); uint256 c = a / b; // assert(a == b * c + a % b); // There is no case in which this doesn't hold return c; } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * Reverts when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b) internal pure returns (uint256) { return mod(a, b, "SafeMath: modulo by zero"); } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * Reverts with custom message when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b != 0, errorMessage); return a % b; } }
/** * @dev Wrappers over Solidity's arithmetic operations with added overflow * checks. * * Arithmetic operations in Solidity wrap on overflow. This can easily result * in bugs, because programmers usually assume that an overflow raises an * error, which is the standard behavior in high level programming languages. * `SafeMath` restores this intuition by reverting the transaction when an * operation overflows. * * Using this library instead of the unchecked operations eliminates an entire * class of bugs, so it's recommended to use it always. */
NatSpecMultiLine
mul
function mul(uint256 a, uint256 b) internal pure returns (uint256) { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522 if (a == 0) { return 0; } uint256 c = a * b; require(c / a == b, "SafeMath: multiplication overflow"); return c; }
/** * @dev Returns the multiplication of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `*` operator. * * Requirements: * * - Multiplication cannot overflow. */
NatSpecMultiLine
v0.6.12+commit.27d51765
GNU GPLv2
ipfs://2c46401db6fba9a9044d2a9ef4a783487fdd694901d8f835f40463f41db7374a
{ "func_code_index": [ 1613, 2089 ] }
2,045
CROWED
CROWED.sol
0x7216ae77b12fdcf250caff22b252bdeb3f188e35
Solidity
SafeMath
library SafeMath { /** * @dev Returns the addition of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `+` operator. * * Requirements: * * - Addition cannot overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; require(c >= a, "SafeMath: addition overflow"); return c; } /** * @dev Returns the subtraction of two unsigned integers, reverting on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { return sub(a, b, "SafeMath: subtraction overflow"); } /** * @dev Returns the subtraction of two unsigned integers, reverting with custom message on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b <= a, errorMessage); uint256 c = a - b; return c; } /** * @dev Returns the multiplication of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `*` operator. * * Requirements: * * - Multiplication cannot overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522 if (a == 0) { return 0; } uint256 c = a * b; require(c / a == b, "SafeMath: multiplication overflow"); return c; } /** * @dev Returns the integer division of two unsigned integers. Reverts on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { return div(a, b, "SafeMath: division by zero"); } /** * @dev Returns the integer division of two unsigned integers. Reverts with custom message on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b > 0, errorMessage); uint256 c = a / b; // assert(a == b * c + a % b); // There is no case in which this doesn't hold return c; } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * Reverts when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b) internal pure returns (uint256) { return mod(a, b, "SafeMath: modulo by zero"); } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * Reverts with custom message when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b != 0, errorMessage); return a % b; } }
/** * @dev Wrappers over Solidity's arithmetic operations with added overflow * checks. * * Arithmetic operations in Solidity wrap on overflow. This can easily result * in bugs, because programmers usually assume that an overflow raises an * error, which is the standard behavior in high level programming languages. * `SafeMath` restores this intuition by reverting the transaction when an * operation overflows. * * Using this library instead of the unchecked operations eliminates an entire * class of bugs, so it's recommended to use it always. */
NatSpecMultiLine
div
function div(uint256 a, uint256 b) internal pure returns (uint256) { return div(a, b, "SafeMath: division by zero"); }
/** * @dev Returns the integer division of two unsigned integers. Reverts on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */
NatSpecMultiLine
v0.6.12+commit.27d51765
GNU GPLv2
ipfs://2c46401db6fba9a9044d2a9ef4a783487fdd694901d8f835f40463f41db7374a
{ "func_code_index": [ 2560, 2697 ] }
2,046
CROWED
CROWED.sol
0x7216ae77b12fdcf250caff22b252bdeb3f188e35
Solidity
SafeMath
library SafeMath { /** * @dev Returns the addition of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `+` operator. * * Requirements: * * - Addition cannot overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; require(c >= a, "SafeMath: addition overflow"); return c; } /** * @dev Returns the subtraction of two unsigned integers, reverting on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { return sub(a, b, "SafeMath: subtraction overflow"); } /** * @dev Returns the subtraction of two unsigned integers, reverting with custom message on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b <= a, errorMessage); uint256 c = a - b; return c; } /** * @dev Returns the multiplication of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `*` operator. * * Requirements: * * - Multiplication cannot overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522 if (a == 0) { return 0; } uint256 c = a * b; require(c / a == b, "SafeMath: multiplication overflow"); return c; } /** * @dev Returns the integer division of two unsigned integers. Reverts on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { return div(a, b, "SafeMath: division by zero"); } /** * @dev Returns the integer division of two unsigned integers. Reverts with custom message on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b > 0, errorMessage); uint256 c = a / b; // assert(a == b * c + a % b); // There is no case in which this doesn't hold return c; } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * Reverts when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b) internal pure returns (uint256) { return mod(a, b, "SafeMath: modulo by zero"); } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * Reverts with custom message when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b != 0, errorMessage); return a % b; } }
/** * @dev Wrappers over Solidity's arithmetic operations with added overflow * checks. * * Arithmetic operations in Solidity wrap on overflow. This can easily result * in bugs, because programmers usually assume that an overflow raises an * error, which is the standard behavior in high level programming languages. * `SafeMath` restores this intuition by reverting the transaction when an * operation overflows. * * Using this library instead of the unchecked operations eliminates an entire * class of bugs, so it's recommended to use it always. */
NatSpecMultiLine
div
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b > 0, errorMessage); uint256 c = a / b; // assert(a == b * c + a % b); // There is no case in which this doesn't hold return c; }
/** * @dev Returns the integer division of two unsigned integers. Reverts with custom message on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */
NatSpecMultiLine
v0.6.12+commit.27d51765
GNU GPLv2
ipfs://2c46401db6fba9a9044d2a9ef4a783487fdd694901d8f835f40463f41db7374a
{ "func_code_index": [ 3188, 3471 ] }
2,047
CROWED
CROWED.sol
0x7216ae77b12fdcf250caff22b252bdeb3f188e35
Solidity
SafeMath
library SafeMath { /** * @dev Returns the addition of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `+` operator. * * Requirements: * * - Addition cannot overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; require(c >= a, "SafeMath: addition overflow"); return c; } /** * @dev Returns the subtraction of two unsigned integers, reverting on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { return sub(a, b, "SafeMath: subtraction overflow"); } /** * @dev Returns the subtraction of two unsigned integers, reverting with custom message on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b <= a, errorMessage); uint256 c = a - b; return c; } /** * @dev Returns the multiplication of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `*` operator. * * Requirements: * * - Multiplication cannot overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522 if (a == 0) { return 0; } uint256 c = a * b; require(c / a == b, "SafeMath: multiplication overflow"); return c; } /** * @dev Returns the integer division of two unsigned integers. Reverts on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { return div(a, b, "SafeMath: division by zero"); } /** * @dev Returns the integer division of two unsigned integers. Reverts with custom message on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b > 0, errorMessage); uint256 c = a / b; // assert(a == b * c + a % b); // There is no case in which this doesn't hold return c; } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * Reverts when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b) internal pure returns (uint256) { return mod(a, b, "SafeMath: modulo by zero"); } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * Reverts with custom message when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b != 0, errorMessage); return a % b; } }
/** * @dev Wrappers over Solidity's arithmetic operations with added overflow * checks. * * Arithmetic operations in Solidity wrap on overflow. This can easily result * in bugs, because programmers usually assume that an overflow raises an * error, which is the standard behavior in high level programming languages. * `SafeMath` restores this intuition by reverting the transaction when an * operation overflows. * * Using this library instead of the unchecked operations eliminates an entire * class of bugs, so it's recommended to use it always. */
NatSpecMultiLine
mod
function mod(uint256 a, uint256 b) internal pure returns (uint256) { return mod(a, b, "SafeMath: modulo by zero"); }
/** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * Reverts when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */
NatSpecMultiLine
v0.6.12+commit.27d51765
GNU GPLv2
ipfs://2c46401db6fba9a9044d2a9ef4a783487fdd694901d8f835f40463f41db7374a
{ "func_code_index": [ 3931, 4066 ] }
2,048
CROWED
CROWED.sol
0x7216ae77b12fdcf250caff22b252bdeb3f188e35
Solidity
SafeMath
library SafeMath { /** * @dev Returns the addition of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `+` operator. * * Requirements: * * - Addition cannot overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; require(c >= a, "SafeMath: addition overflow"); return c; } /** * @dev Returns the subtraction of two unsigned integers, reverting on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { return sub(a, b, "SafeMath: subtraction overflow"); } /** * @dev Returns the subtraction of two unsigned integers, reverting with custom message on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b <= a, errorMessage); uint256 c = a - b; return c; } /** * @dev Returns the multiplication of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `*` operator. * * Requirements: * * - Multiplication cannot overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522 if (a == 0) { return 0; } uint256 c = a * b; require(c / a == b, "SafeMath: multiplication overflow"); return c; } /** * @dev Returns the integer division of two unsigned integers. Reverts on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { return div(a, b, "SafeMath: division by zero"); } /** * @dev Returns the integer division of two unsigned integers. Reverts with custom message on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b > 0, errorMessage); uint256 c = a / b; // assert(a == b * c + a % b); // There is no case in which this doesn't hold return c; } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * Reverts when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b) internal pure returns (uint256) { return mod(a, b, "SafeMath: modulo by zero"); } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * Reverts with custom message when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b != 0, errorMessage); return a % b; } }
/** * @dev Wrappers over Solidity's arithmetic operations with added overflow * checks. * * Arithmetic operations in Solidity wrap on overflow. This can easily result * in bugs, because programmers usually assume that an overflow raises an * error, which is the standard behavior in high level programming languages. * `SafeMath` restores this intuition by reverting the transaction when an * operation overflows. * * Using this library instead of the unchecked operations eliminates an entire * class of bugs, so it's recommended to use it always. */
NatSpecMultiLine
mod
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b != 0, errorMessage); return a % b; }
/** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * Reverts with custom message when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */
NatSpecMultiLine
v0.6.12+commit.27d51765
GNU GPLv2
ipfs://2c46401db6fba9a9044d2a9ef4a783487fdd694901d8f835f40463f41db7374a
{ "func_code_index": [ 4546, 4717 ] }
2,049
CROWED
CROWED.sol
0x7216ae77b12fdcf250caff22b252bdeb3f188e35
Solidity
Address
library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== */ function isContract(address account) internal view returns (bool) { // According to EIP-1052, 0x0 is the value returned for not-yet created accounts // and 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470 is returned // for accounts without code, i.e. `keccak256('')` bytes32 codehash; bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470; // solhint-disable-next-line no-inline-assembly assembly { codehash := extcodehash(account) } return (codehash != accountHash && codehash != 0x0); } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); // solhint-disable-next-line avoid-low-level-calls, avoid-call-value (bool success, ) = recipient.call{ value: amount }(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain`call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCall(target, data, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) { return _functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); return _functionCallWithValue(target, data, value, errorMessage); } function _functionCallWithValue(address target, bytes memory data, uint256 weiValue, string memory errorMessage) private returns (bytes memory) { require(isContract(target), "Address: call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.call{ value: weiValue }(data); if (success) { return returndata; } else { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly // solhint-disable-next-line no-inline-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } }
/** * @dev Collection of functions related to the address type */
NatSpecMultiLine
isContract
function isContract(address account) internal view returns (bool) { // According to EIP-1052, 0x0 is the value returned for not-yet created accounts // and 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470 is returned // for accounts without code, i.e. `keccak256('')` bytes32 codehash; bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470; // solhint-disable-next-line no-inline-assembly assembly { codehash := extcodehash(account) } return (codehash != accountHash && codehash != 0x0); }
/** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== */
NatSpecMultiLine
v0.6.12+commit.27d51765
GNU GPLv2
ipfs://2c46401db6fba9a9044d2a9ef4a783487fdd694901d8f835f40463f41db7374a
{ "func_code_index": [ 606, 1230 ] }
2,050
CROWED
CROWED.sol
0x7216ae77b12fdcf250caff22b252bdeb3f188e35
Solidity
Address
library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== */ function isContract(address account) internal view returns (bool) { // According to EIP-1052, 0x0 is the value returned for not-yet created accounts // and 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470 is returned // for accounts without code, i.e. `keccak256('')` bytes32 codehash; bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470; // solhint-disable-next-line no-inline-assembly assembly { codehash := extcodehash(account) } return (codehash != accountHash && codehash != 0x0); } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); // solhint-disable-next-line avoid-low-level-calls, avoid-call-value (bool success, ) = recipient.call{ value: amount }(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain`call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCall(target, data, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) { return _functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); return _functionCallWithValue(target, data, value, errorMessage); } function _functionCallWithValue(address target, bytes memory data, uint256 weiValue, string memory errorMessage) private returns (bytes memory) { require(isContract(target), "Address: call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.call{ value: weiValue }(data); if (success) { return returndata; } else { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly // solhint-disable-next-line no-inline-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } }
/** * @dev Collection of functions related to the address type */
NatSpecMultiLine
sendValue
function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); // solhint-disable-next-line avoid-low-level-calls, avoid-call-value (bool success, ) = recipient.call{ value: amount }(""); require(success, "Address: unable to send value, recipient may have reverted"); }
/** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */
NatSpecMultiLine
v0.6.12+commit.27d51765
GNU GPLv2
ipfs://2c46401db6fba9a9044d2a9ef4a783487fdd694901d8f835f40463f41db7374a
{ "func_code_index": [ 2160, 2562 ] }
2,051
CROWED
CROWED.sol
0x7216ae77b12fdcf250caff22b252bdeb3f188e35
Solidity
Address
library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== */ function isContract(address account) internal view returns (bool) { // According to EIP-1052, 0x0 is the value returned for not-yet created accounts // and 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470 is returned // for accounts without code, i.e. `keccak256('')` bytes32 codehash; bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470; // solhint-disable-next-line no-inline-assembly assembly { codehash := extcodehash(account) } return (codehash != accountHash && codehash != 0x0); } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); // solhint-disable-next-line avoid-low-level-calls, avoid-call-value (bool success, ) = recipient.call{ value: amount }(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain`call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCall(target, data, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) { return _functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); return _functionCallWithValue(target, data, value, errorMessage); } function _functionCallWithValue(address target, bytes memory data, uint256 weiValue, string memory errorMessage) private returns (bytes memory) { require(isContract(target), "Address: call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.call{ value: weiValue }(data); if (success) { return returndata; } else { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly // solhint-disable-next-line no-inline-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } }
/** * @dev Collection of functions related to the address type */
NatSpecMultiLine
functionCall
function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCall(target, data, "Address: low-level call failed"); }
/** * @dev Performs a Solidity function call using a low level `call`. A * plain`call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */
NatSpecMultiLine
v0.6.12+commit.27d51765
GNU GPLv2
ipfs://2c46401db6fba9a9044d2a9ef4a783487fdd694901d8f835f40463f41db7374a
{ "func_code_index": [ 3318, 3496 ] }
2,052
CROWED
CROWED.sol
0x7216ae77b12fdcf250caff22b252bdeb3f188e35
Solidity
Address
library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== */ function isContract(address account) internal view returns (bool) { // According to EIP-1052, 0x0 is the value returned for not-yet created accounts // and 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470 is returned // for accounts without code, i.e. `keccak256('')` bytes32 codehash; bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470; // solhint-disable-next-line no-inline-assembly assembly { codehash := extcodehash(account) } return (codehash != accountHash && codehash != 0x0); } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); // solhint-disable-next-line avoid-low-level-calls, avoid-call-value (bool success, ) = recipient.call{ value: amount }(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain`call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCall(target, data, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) { return _functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); return _functionCallWithValue(target, data, value, errorMessage); } function _functionCallWithValue(address target, bytes memory data, uint256 weiValue, string memory errorMessage) private returns (bytes memory) { require(isContract(target), "Address: call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.call{ value: weiValue }(data); if (success) { return returndata; } else { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly // solhint-disable-next-line no-inline-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } }
/** * @dev Collection of functions related to the address type */
NatSpecMultiLine
functionCall
function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) { return _functionCallWithValue(target, data, 0, errorMessage); }
/** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */
NatSpecMultiLine
v0.6.12+commit.27d51765
GNU GPLv2
ipfs://2c46401db6fba9a9044d2a9ef4a783487fdd694901d8f835f40463f41db7374a
{ "func_code_index": [ 3721, 3922 ] }
2,053
CROWED
CROWED.sol
0x7216ae77b12fdcf250caff22b252bdeb3f188e35
Solidity
Address
library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== */ function isContract(address account) internal view returns (bool) { // According to EIP-1052, 0x0 is the value returned for not-yet created accounts // and 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470 is returned // for accounts without code, i.e. `keccak256('')` bytes32 codehash; bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470; // solhint-disable-next-line no-inline-assembly assembly { codehash := extcodehash(account) } return (codehash != accountHash && codehash != 0x0); } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); // solhint-disable-next-line avoid-low-level-calls, avoid-call-value (bool success, ) = recipient.call{ value: amount }(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain`call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCall(target, data, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) { return _functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); return _functionCallWithValue(target, data, value, errorMessage); } function _functionCallWithValue(address target, bytes memory data, uint256 weiValue, string memory errorMessage) private returns (bytes memory) { require(isContract(target), "Address: call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.call{ value: weiValue }(data); if (success) { return returndata; } else { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly // solhint-disable-next-line no-inline-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } }
/** * @dev Collection of functions related to the address type */
NatSpecMultiLine
functionCallWithValue
function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); }
/** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */
NatSpecMultiLine
v0.6.12+commit.27d51765
GNU GPLv2
ipfs://2c46401db6fba9a9044d2a9ef4a783487fdd694901d8f835f40463f41db7374a
{ "func_code_index": [ 4292, 4523 ] }
2,054
CROWED
CROWED.sol
0x7216ae77b12fdcf250caff22b252bdeb3f188e35
Solidity
Address
library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== */ function isContract(address account) internal view returns (bool) { // According to EIP-1052, 0x0 is the value returned for not-yet created accounts // and 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470 is returned // for accounts without code, i.e. `keccak256('')` bytes32 codehash; bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470; // solhint-disable-next-line no-inline-assembly assembly { codehash := extcodehash(account) } return (codehash != accountHash && codehash != 0x0); } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); // solhint-disable-next-line avoid-low-level-calls, avoid-call-value (bool success, ) = recipient.call{ value: amount }(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain`call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCall(target, data, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) { return _functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); return _functionCallWithValue(target, data, value, errorMessage); } function _functionCallWithValue(address target, bytes memory data, uint256 weiValue, string memory errorMessage) private returns (bytes memory) { require(isContract(target), "Address: call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.call{ value: weiValue }(data); if (success) { return returndata; } else { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly // solhint-disable-next-line no-inline-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } }
/** * @dev Collection of functions related to the address type */
NatSpecMultiLine
functionCallWithValue
function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); return _functionCallWithValue(target, data, value, errorMessage); }
/** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */
NatSpecMultiLine
v0.6.12+commit.27d51765
GNU GPLv2
ipfs://2c46401db6fba9a9044d2a9ef4a783487fdd694901d8f835f40463f41db7374a
{ "func_code_index": [ 4774, 5095 ] }
2,055
CROWED
CROWED.sol
0x7216ae77b12fdcf250caff22b252bdeb3f188e35
Solidity
SafeERC20
library SafeERC20 { using SafeMath for uint256; using Address for address; function safeTransfer(IERC20 token, address to, uint256 value) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value)); } function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value)); } /** * @dev Deprecated. This function has issues similar to the ones found in * {IERC20-approve}, and its usage is discouraged. * * Whenever possible, use {safeIncreaseAllowance} and * {safeDecreaseAllowance} instead. */ function safeApprove(IERC20 token, address spender, uint256 value) internal { // safeApprove should only be called when setting an initial allowance, // or when resetting it to zero. To increase and decrease it, use // 'safeIncreaseAllowance' and 'safeDecreaseAllowance' // solhint-disable-next-line max-line-length require((value == 0) || (token.allowance(address(this), spender) == 0), "SafeERC20: approve from non-zero to non-zero allowance" ); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value)); } function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal { uint256 newAllowance = token.allowance(address(this), spender).add(value); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal { uint256 newAllowance = token.allowance(address(this), spender).sub(value, "SafeERC20: decreased allowance below zero"); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } /** * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement * on the return value: the return value is optional (but if data is returned, it must not be false). * @param token The token targeted by the call. * @param data The call data (encoded using abi.encode or one of its variants). */ function _callOptionalReturn(IERC20 token, bytes memory data) private { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that // the target address contains contract code and also asserts for success in the low-level call. bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed"); if (returndata.length > 0) { // Return data is optional // solhint-disable-next-line max-line-length require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed"); } } }
/** * @title SafeERC20 * @dev Wrappers around ERC20 operations that throw on failure (when the token * contract returns false). Tokens that return no value (and instead revert or * throw on failure) are also supported, non-reverting calls are assumed to be * successful. * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract, * which allows you to call the safe operations as `token.safeTransfer(...)`, etc. */
NatSpecMultiLine
safeApprove
function safeApprove(IERC20 token, address spender, uint256 value) internal { // safeApprove should only be called when setting an initial allowance, // or when resetting it to zero. To increase and decrease it, use // 'safeIncreaseAllowance' and 'safeDecreaseAllowance' // solhint-disable-next-line max-line-length require((value == 0) || (token.allowance(address(this), spender) == 0), "SafeERC20: approve from non-zero to non-zero allowance" ); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value)); }
/** * @dev Deprecated. This function has issues similar to the ones found in * {IERC20-approve}, and its usage is discouraged. * * Whenever possible, use {safeIncreaseAllowance} and * {safeDecreaseAllowance} instead. */
NatSpecMultiLine
v0.6.12+commit.27d51765
GNU GPLv2
ipfs://2c46401db6fba9a9044d2a9ef4a783487fdd694901d8f835f40463f41db7374a
{ "func_code_index": [ 747, 1374 ] }
2,056
CROWED
CROWED.sol
0x7216ae77b12fdcf250caff22b252bdeb3f188e35
Solidity
SafeERC20
library SafeERC20 { using SafeMath for uint256; using Address for address; function safeTransfer(IERC20 token, address to, uint256 value) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value)); } function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value)); } /** * @dev Deprecated. This function has issues similar to the ones found in * {IERC20-approve}, and its usage is discouraged. * * Whenever possible, use {safeIncreaseAllowance} and * {safeDecreaseAllowance} instead. */ function safeApprove(IERC20 token, address spender, uint256 value) internal { // safeApprove should only be called when setting an initial allowance, // or when resetting it to zero. To increase and decrease it, use // 'safeIncreaseAllowance' and 'safeDecreaseAllowance' // solhint-disable-next-line max-line-length require((value == 0) || (token.allowance(address(this), spender) == 0), "SafeERC20: approve from non-zero to non-zero allowance" ); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value)); } function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal { uint256 newAllowance = token.allowance(address(this), spender).add(value); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal { uint256 newAllowance = token.allowance(address(this), spender).sub(value, "SafeERC20: decreased allowance below zero"); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } /** * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement * on the return value: the return value is optional (but if data is returned, it must not be false). * @param token The token targeted by the call. * @param data The call data (encoded using abi.encode or one of its variants). */ function _callOptionalReturn(IERC20 token, bytes memory data) private { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that // the target address contains contract code and also asserts for success in the low-level call. bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed"); if (returndata.length > 0) { // Return data is optional // solhint-disable-next-line max-line-length require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed"); } } }
/** * @title SafeERC20 * @dev Wrappers around ERC20 operations that throw on failure (when the token * contract returns false). Tokens that return no value (and instead revert or * throw on failure) are also supported, non-reverting calls are assumed to be * successful. * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract, * which allows you to call the safe operations as `token.safeTransfer(...)`, etc. */
NatSpecMultiLine
_callOptionalReturn
function _callOptionalReturn(IERC20 token, bytes memory data) private { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that // the target address contains contract code and also asserts for success in the low-level call. bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed"); if (returndata.length > 0) { // Return data is optional // solhint-disable-next-line max-line-length require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed"); } }
/** * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement * on the return value: the return value is optional (but if data is returned, it must not be false). * @param token The token targeted by the call. * @param data The call data (encoded using abi.encode or one of its variants). */
NatSpecMultiLine
v0.6.12+commit.27d51765
GNU GPLv2
ipfs://2c46401db6fba9a9044d2a9ef4a783487fdd694901d8f835f40463f41db7374a
{ "func_code_index": [ 2393, 3159 ] }
2,057
CROWED
CROWED.sol
0x7216ae77b12fdcf250caff22b252bdeb3f188e35
Solidity
Ownable
contract Ownable is Context { /** * @dev So here we seperate the rights of the classic ownership into 'owner' and 'minter' * this way the developer/owner stays the 'owner' and can make changes like adding a pool * at any time but cannot mint anymore as soon as the 'minter' gets changes (to the chef contract) */ address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor () internal { address msgSender = _msgSender(); _owner = msgSender; emit OwnershipTransferred(address(0), msgSender); } /** * @dev Returns the address of the current owner. */ function owner() public view returns (address) { return _owner; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(_owner == _msgSender(), "Ownable: caller is not the owner"); _; } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { emit OwnershipTransferred(_owner, address(0)); _owner = address(0); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { require(newOwner != address(0), "Ownable: new owner is the zero address"); emit OwnershipTransferred(_owner, newOwner); _owner = newOwner; } }
/** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * By default, the owner account will be the one that deploys the contract. This * can later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */
NatSpecMultiLine
owner
function owner() public view returns (address) { return _owner; }
/** * @dev Returns the address of the current owner. */
NatSpecMultiLine
v0.6.12+commit.27d51765
GNU GPLv2
ipfs://2c46401db6fba9a9044d2a9ef4a783487fdd694901d8f835f40463f41db7374a
{ "func_code_index": [ 811, 895 ] }
2,058
CROWED
CROWED.sol
0x7216ae77b12fdcf250caff22b252bdeb3f188e35
Solidity
Ownable
contract Ownable is Context { /** * @dev So here we seperate the rights of the classic ownership into 'owner' and 'minter' * this way the developer/owner stays the 'owner' and can make changes like adding a pool * at any time but cannot mint anymore as soon as the 'minter' gets changes (to the chef contract) */ address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor () internal { address msgSender = _msgSender(); _owner = msgSender; emit OwnershipTransferred(address(0), msgSender); } /** * @dev Returns the address of the current owner. */ function owner() public view returns (address) { return _owner; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(_owner == _msgSender(), "Ownable: caller is not the owner"); _; } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { emit OwnershipTransferred(_owner, address(0)); _owner = address(0); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { require(newOwner != address(0), "Ownable: new owner is the zero address"); emit OwnershipTransferred(_owner, newOwner); _owner = newOwner; } }
/** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * By default, the owner account will be the one that deploys the contract. This * can later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */
NatSpecMultiLine
renounceOwnership
function renounceOwnership() public virtual onlyOwner { emit OwnershipTransferred(_owner, address(0)); _owner = address(0); }
/** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */
NatSpecMultiLine
v0.6.12+commit.27d51765
GNU GPLv2
ipfs://2c46401db6fba9a9044d2a9ef4a783487fdd694901d8f835f40463f41db7374a
{ "func_code_index": [ 1453, 1606 ] }
2,059
CROWED
CROWED.sol
0x7216ae77b12fdcf250caff22b252bdeb3f188e35
Solidity
Ownable
contract Ownable is Context { /** * @dev So here we seperate the rights of the classic ownership into 'owner' and 'minter' * this way the developer/owner stays the 'owner' and can make changes like adding a pool * at any time but cannot mint anymore as soon as the 'minter' gets changes (to the chef contract) */ address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor () internal { address msgSender = _msgSender(); _owner = msgSender; emit OwnershipTransferred(address(0), msgSender); } /** * @dev Returns the address of the current owner. */ function owner() public view returns (address) { return _owner; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(_owner == _msgSender(), "Ownable: caller is not the owner"); _; } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { emit OwnershipTransferred(_owner, address(0)); _owner = address(0); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { require(newOwner != address(0), "Ownable: new owner is the zero address"); emit OwnershipTransferred(_owner, newOwner); _owner = newOwner; } }
/** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * By default, the owner account will be the one that deploys the contract. This * can later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */
NatSpecMultiLine
transferOwnership
function transferOwnership(address newOwner) public virtual onlyOwner { require(newOwner != address(0), "Ownable: new owner is the zero address"); emit OwnershipTransferred(_owner, newOwner); _owner = newOwner; }
/** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */
NatSpecMultiLine
v0.6.12+commit.27d51765
GNU GPLv2
ipfs://2c46401db6fba9a9044d2a9ef4a783487fdd694901d8f835f40463f41db7374a
{ "func_code_index": [ 1756, 2005 ] }
2,060
CROWED
CROWED.sol
0x7216ae77b12fdcf250caff22b252bdeb3f188e35
Solidity
Mintable
contract Mintable is Context { /** * @dev So here we seperate the rights of the classic ownership into 'owner' and 'minter' * this way the developer/owner stays the 'owner' and can make changes like adding a pool * at any time but cannot mint anymore as soon as the 'minter' gets changes (to the chef contract) */ address private _minter; event MintershipTransferred(address indexed previousMinter, address indexed newMinter); /** * @dev Initializes the contract setting the deployer as the initial minter. */ constructor () internal { address msgSender = _msgSender(); _minter = msgSender; emit MintershipTransferred(address(0), msgSender); } /** * @dev Returns the address of the current minter. */ function minter() public view returns (address) { return _minter; } /** * @dev Throws if called by any account other than the minter. */ modifier onlyMinter() { require(_minter == _msgSender(), "Mintable: caller is not the minter"); _; } /** * @dev Transfers mintership of the contract to a new account (`newMinter`). * Can only be called by the current minter. */ function transferMintership(address newMinter) public virtual onlyMinter { require(newMinter != address(0), "Mintable: new minter is the zero address"); emit MintershipTransferred(_minter, newMinter); _minter = newMinter; } }
/** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an minter) that can be granted exclusive access to * specific functions. * * By default, the minter account will be the one that deploys the contract. This * can later be changed with {transferMintership}. * * This module is used through inheritance. It will make available the modifier * `onlyMinter`, which can be applied to your functions to restrict their use to * the minter. */
NatSpecMultiLine
minter
function minter() public view returns (address) { return _minter; }
/** * @dev Returns the address of the current minter. */
NatSpecMultiLine
v0.6.12+commit.27d51765
GNU GPLv2
ipfs://2c46401db6fba9a9044d2a9ef4a783487fdd694901d8f835f40463f41db7374a
{ "func_code_index": [ 820, 906 ] }
2,061
CROWED
CROWED.sol
0x7216ae77b12fdcf250caff22b252bdeb3f188e35
Solidity
Mintable
contract Mintable is Context { /** * @dev So here we seperate the rights of the classic ownership into 'owner' and 'minter' * this way the developer/owner stays the 'owner' and can make changes like adding a pool * at any time but cannot mint anymore as soon as the 'minter' gets changes (to the chef contract) */ address private _minter; event MintershipTransferred(address indexed previousMinter, address indexed newMinter); /** * @dev Initializes the contract setting the deployer as the initial minter. */ constructor () internal { address msgSender = _msgSender(); _minter = msgSender; emit MintershipTransferred(address(0), msgSender); } /** * @dev Returns the address of the current minter. */ function minter() public view returns (address) { return _minter; } /** * @dev Throws if called by any account other than the minter. */ modifier onlyMinter() { require(_minter == _msgSender(), "Mintable: caller is not the minter"); _; } /** * @dev Transfers mintership of the contract to a new account (`newMinter`). * Can only be called by the current minter. */ function transferMintership(address newMinter) public virtual onlyMinter { require(newMinter != address(0), "Mintable: new minter is the zero address"); emit MintershipTransferred(_minter, newMinter); _minter = newMinter; } }
/** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an minter) that can be granted exclusive access to * specific functions. * * By default, the minter account will be the one that deploys the contract. This * can later be changed with {transferMintership}. * * This module is used through inheritance. It will make available the modifier * `onlyMinter`, which can be applied to your functions to restrict their use to * the minter. */
NatSpecMultiLine
transferMintership
function transferMintership(address newMinter) public virtual onlyMinter { require(newMinter != address(0), "Mintable: new minter is the zero address"); emit MintershipTransferred(_minter, newMinter); _minter = newMinter; }
/** * @dev Transfers mintership of the contract to a new account (`newMinter`). * Can only be called by the current minter. */
NatSpecMultiLine
v0.6.12+commit.27d51765
GNU GPLv2
ipfs://2c46401db6fba9a9044d2a9ef4a783487fdd694901d8f835f40463f41db7374a
{ "func_code_index": [ 1276, 1536 ] }
2,062
CROWED
CROWED.sol
0x7216ae77b12fdcf250caff22b252bdeb3f188e35
Solidity
ERC20
contract ERC20 is Context, IERC20 { using SafeMath for uint256; using Address for address; mapping (address => uint256) private _balances; mapping (address => mapping (address => uint256)) private _allowances; uint256 private _totalSupply; uint256 private _burnedSupply; uint256 private _burnRate; string private _name; string private _symbol; uint256 private _decimals; /** * @dev Sets the values for {name} and {symbol}, initializes {decimals} with * a default value of 18. * * To select a different value for {decimals}, use {_setupDecimals}. * * All three of these values are immutable: they can only be set once during * construction. */ constructor (string memory name, string memory symbol, uint256 decimals, uint256 burnrate, uint256 initSupply) public { _name = name; _symbol = symbol; _decimals = decimals; _burnRate = burnrate; _totalSupply = 0; _mint(msg.sender, initSupply*(10**_decimals)); // initial 1000 SAIYAN tokens _burnedSupply = 0; } /** * @dev Returns the name of the token. */ function name() public view returns (string memory) { return _name; } /** * @dev Returns the symbol of the token, usually a shorter version of the * name. */ function symbol() public view returns (string memory) { return _symbol; } /** * @dev Returns the number of decimals used to get its user representation. * For example, if `decimals` equals `2`, a balance of `505` tokens should * be displayed to a user as `5,05` (`505 / 10 ** 2`). * * Tokens usually opt for a value of 18, imitating the relationship between * Ether and Wei. This is the value {ERC20} uses, unless {_setupDecimals} is * called. * * NOTE: This information is only used for _display_ purposes: it in * no way affects any of the arithmetic of the contract, including * {IERC20-balanceOf} and {IERC20-transfer}. */ function decimals() public view returns (uint256) { return _decimals; } /** * @dev See {IERC20-totalSupply}. */ function totalSupply() public view override returns (uint256) { return _totalSupply; } /** * @dev Returns the amount of burned tokens. */ function burnedSupply() public view returns (uint256) { return _burnedSupply; } /** * @dev Returns the burnrate. */ function burnRate() public view returns (uint256) { return _burnRate; } /** * @dev See {IERC20-balanceOf}. */ function balanceOf(address account) public view override returns (uint256) { return _balances[account]; } /** * @dev See {IERC20-transfer}. * * Requirements: * * - `recipient` cannot be the zero address. * - the caller must have a balance of at least `amount`. */ function transfer(address recipient, uint256 amount) public virtual override returns (bool) { _transfer(_msgSender(), recipient, amount); return true; } /** * @dev See {IERC20-transfer}. * * Requirements: * * - `account` cannot be the zero address. * - the caller must have a balance of at least `amount`. */ function burn(uint256 amount) public virtual returns (bool) { _burn(_msgSender(), amount); return true; } function allowance(address owner, address spender) public view virtual override returns (uint256) { return _allowances[owner][spender]; } function approve(address spender, uint256 amount) public virtual override returns (bool) { _approve(_msgSender(), spender, amount); return true; } function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) { _transfer(sender, recipient, amount); _approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance")); return true; } function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue)); return true; } function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, "ERC20: decreased allowance below zero")); return true; } function _transfer(address sender, address recipient, uint256 amount) internal virtual { require(sender != address(0), "ERC20: transfer from the zero address"); require(recipient != address(0), "ERC20: transfer to the zero address"); uint256 amount_burn = amount.mul(_burnRate).div(100); uint256 amount_send = amount.sub(amount_burn); require(amount == amount_send + amount_burn, "Burn value invalid"); _burn(sender, amount_burn); amount = amount_send; _beforeTokenTransfer(sender, recipient, amount); _balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance"); _balances[recipient] = _balances[recipient].add(amount); emit Transfer(sender, recipient, amount); } function _mint(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: mint to the zero address"); _beforeTokenTransfer(address(0), account, amount); _totalSupply = _totalSupply.add(amount); _balances[account] = _balances[account].add(amount); emit Transfer(address(0), account, amount); } function _burn(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: burn from the zero address"); _beforeTokenTransfer(account, address(0), amount); _balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance"); _totalSupply = _totalSupply.sub(amount); _burnedSupply = _burnedSupply.add(amount); emit Transfer(account, address(0), amount); } function _approve(address owner, address spender, uint256 amount) internal virtual { require(owner != address(0), "ERC20: approve from the zero address"); require(spender != address(0), "ERC20: approve to the zero address"); _allowances[owner][spender] = amount; emit Approval(owner, spender, amount); } function _setupBurnrate(uint8 burnrate_) internal virtual { _burnRate = burnrate_; } function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual { } }
/** * @dev Implementation of the {IERC20} interface. * * This implementation is agnostic to the way tokens are created. This means * that a supply mechanism has to be added in a derived contract using {_mint}. * For a generic mechanism see {ERC20PresetMinterPauser}. * * TIP: For a detailed writeup see our guide * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How * to implement supply mechanisms]. * * We have followed general OpenZeppelin guidelines: functions revert instead * of returning `false` on failure. This behavior is nonetheless conventional * and does not conflict with the expectations of ERC20 applications. * * Additionally, an {Approval} event is emitted on calls to {transferFrom}. * This allows applications to reconstruct the allowance for all accounts just * by listening to said events. Other implementations of the EIP may not emit * these events, as it isn't required by the specification. * * Finally, the non-standard {decreaseAllowance} and {increaseAllowance} * functions have been added to mitigate the well-known issues around setting * allowances. See {IERC20-approve}. */
NatSpecMultiLine
name
function name() public view returns (string memory) { return _name; }
/** * @dev Returns the name of the token. */
NatSpecMultiLine
v0.6.12+commit.27d51765
GNU GPLv2
ipfs://2c46401db6fba9a9044d2a9ef4a783487fdd694901d8f835f40463f41db7374a
{ "func_code_index": [ 1202, 1290 ] }
2,063
CROWED
CROWED.sol
0x7216ae77b12fdcf250caff22b252bdeb3f188e35
Solidity
ERC20
contract ERC20 is Context, IERC20 { using SafeMath for uint256; using Address for address; mapping (address => uint256) private _balances; mapping (address => mapping (address => uint256)) private _allowances; uint256 private _totalSupply; uint256 private _burnedSupply; uint256 private _burnRate; string private _name; string private _symbol; uint256 private _decimals; /** * @dev Sets the values for {name} and {symbol}, initializes {decimals} with * a default value of 18. * * To select a different value for {decimals}, use {_setupDecimals}. * * All three of these values are immutable: they can only be set once during * construction. */ constructor (string memory name, string memory symbol, uint256 decimals, uint256 burnrate, uint256 initSupply) public { _name = name; _symbol = symbol; _decimals = decimals; _burnRate = burnrate; _totalSupply = 0; _mint(msg.sender, initSupply*(10**_decimals)); // initial 1000 SAIYAN tokens _burnedSupply = 0; } /** * @dev Returns the name of the token. */ function name() public view returns (string memory) { return _name; } /** * @dev Returns the symbol of the token, usually a shorter version of the * name. */ function symbol() public view returns (string memory) { return _symbol; } /** * @dev Returns the number of decimals used to get its user representation. * For example, if `decimals` equals `2`, a balance of `505` tokens should * be displayed to a user as `5,05` (`505 / 10 ** 2`). * * Tokens usually opt for a value of 18, imitating the relationship between * Ether and Wei. This is the value {ERC20} uses, unless {_setupDecimals} is * called. * * NOTE: This information is only used for _display_ purposes: it in * no way affects any of the arithmetic of the contract, including * {IERC20-balanceOf} and {IERC20-transfer}. */ function decimals() public view returns (uint256) { return _decimals; } /** * @dev See {IERC20-totalSupply}. */ function totalSupply() public view override returns (uint256) { return _totalSupply; } /** * @dev Returns the amount of burned tokens. */ function burnedSupply() public view returns (uint256) { return _burnedSupply; } /** * @dev Returns the burnrate. */ function burnRate() public view returns (uint256) { return _burnRate; } /** * @dev See {IERC20-balanceOf}. */ function balanceOf(address account) public view override returns (uint256) { return _balances[account]; } /** * @dev See {IERC20-transfer}. * * Requirements: * * - `recipient` cannot be the zero address. * - the caller must have a balance of at least `amount`. */ function transfer(address recipient, uint256 amount) public virtual override returns (bool) { _transfer(_msgSender(), recipient, amount); return true; } /** * @dev See {IERC20-transfer}. * * Requirements: * * - `account` cannot be the zero address. * - the caller must have a balance of at least `amount`. */ function burn(uint256 amount) public virtual returns (bool) { _burn(_msgSender(), amount); return true; } function allowance(address owner, address spender) public view virtual override returns (uint256) { return _allowances[owner][spender]; } function approve(address spender, uint256 amount) public virtual override returns (bool) { _approve(_msgSender(), spender, amount); return true; } function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) { _transfer(sender, recipient, amount); _approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance")); return true; } function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue)); return true; } function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, "ERC20: decreased allowance below zero")); return true; } function _transfer(address sender, address recipient, uint256 amount) internal virtual { require(sender != address(0), "ERC20: transfer from the zero address"); require(recipient != address(0), "ERC20: transfer to the zero address"); uint256 amount_burn = amount.mul(_burnRate).div(100); uint256 amount_send = amount.sub(amount_burn); require(amount == amount_send + amount_burn, "Burn value invalid"); _burn(sender, amount_burn); amount = amount_send; _beforeTokenTransfer(sender, recipient, amount); _balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance"); _balances[recipient] = _balances[recipient].add(amount); emit Transfer(sender, recipient, amount); } function _mint(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: mint to the zero address"); _beforeTokenTransfer(address(0), account, amount); _totalSupply = _totalSupply.add(amount); _balances[account] = _balances[account].add(amount); emit Transfer(address(0), account, amount); } function _burn(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: burn from the zero address"); _beforeTokenTransfer(account, address(0), amount); _balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance"); _totalSupply = _totalSupply.sub(amount); _burnedSupply = _burnedSupply.add(amount); emit Transfer(account, address(0), amount); } function _approve(address owner, address spender, uint256 amount) internal virtual { require(owner != address(0), "ERC20: approve from the zero address"); require(spender != address(0), "ERC20: approve to the zero address"); _allowances[owner][spender] = amount; emit Approval(owner, spender, amount); } function _setupBurnrate(uint8 burnrate_) internal virtual { _burnRate = burnrate_; } function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual { } }
/** * @dev Implementation of the {IERC20} interface. * * This implementation is agnostic to the way tokens are created. This means * that a supply mechanism has to be added in a derived contract using {_mint}. * For a generic mechanism see {ERC20PresetMinterPauser}. * * TIP: For a detailed writeup see our guide * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How * to implement supply mechanisms]. * * We have followed general OpenZeppelin guidelines: functions revert instead * of returning `false` on failure. This behavior is nonetheless conventional * and does not conflict with the expectations of ERC20 applications. * * Additionally, an {Approval} event is emitted on calls to {transferFrom}. * This allows applications to reconstruct the allowance for all accounts just * by listening to said events. Other implementations of the EIP may not emit * these events, as it isn't required by the specification. * * Finally, the non-standard {decreaseAllowance} and {increaseAllowance} * functions have been added to mitigate the well-known issues around setting * allowances. See {IERC20-approve}. */
NatSpecMultiLine
symbol
function symbol() public view returns (string memory) { return _symbol; }
/** * @dev Returns the symbol of the token, usually a shorter version of the * name. */
NatSpecMultiLine
v0.6.12+commit.27d51765
GNU GPLv2
ipfs://2c46401db6fba9a9044d2a9ef4a783487fdd694901d8f835f40463f41db7374a
{ "func_code_index": [ 1404, 1496 ] }
2,064
CROWED
CROWED.sol
0x7216ae77b12fdcf250caff22b252bdeb3f188e35
Solidity
ERC20
contract ERC20 is Context, IERC20 { using SafeMath for uint256; using Address for address; mapping (address => uint256) private _balances; mapping (address => mapping (address => uint256)) private _allowances; uint256 private _totalSupply; uint256 private _burnedSupply; uint256 private _burnRate; string private _name; string private _symbol; uint256 private _decimals; /** * @dev Sets the values for {name} and {symbol}, initializes {decimals} with * a default value of 18. * * To select a different value for {decimals}, use {_setupDecimals}. * * All three of these values are immutable: they can only be set once during * construction. */ constructor (string memory name, string memory symbol, uint256 decimals, uint256 burnrate, uint256 initSupply) public { _name = name; _symbol = symbol; _decimals = decimals; _burnRate = burnrate; _totalSupply = 0; _mint(msg.sender, initSupply*(10**_decimals)); // initial 1000 SAIYAN tokens _burnedSupply = 0; } /** * @dev Returns the name of the token. */ function name() public view returns (string memory) { return _name; } /** * @dev Returns the symbol of the token, usually a shorter version of the * name. */ function symbol() public view returns (string memory) { return _symbol; } /** * @dev Returns the number of decimals used to get its user representation. * For example, if `decimals` equals `2`, a balance of `505` tokens should * be displayed to a user as `5,05` (`505 / 10 ** 2`). * * Tokens usually opt for a value of 18, imitating the relationship between * Ether and Wei. This is the value {ERC20} uses, unless {_setupDecimals} is * called. * * NOTE: This information is only used for _display_ purposes: it in * no way affects any of the arithmetic of the contract, including * {IERC20-balanceOf} and {IERC20-transfer}. */ function decimals() public view returns (uint256) { return _decimals; } /** * @dev See {IERC20-totalSupply}. */ function totalSupply() public view override returns (uint256) { return _totalSupply; } /** * @dev Returns the amount of burned tokens. */ function burnedSupply() public view returns (uint256) { return _burnedSupply; } /** * @dev Returns the burnrate. */ function burnRate() public view returns (uint256) { return _burnRate; } /** * @dev See {IERC20-balanceOf}. */ function balanceOf(address account) public view override returns (uint256) { return _balances[account]; } /** * @dev See {IERC20-transfer}. * * Requirements: * * - `recipient` cannot be the zero address. * - the caller must have a balance of at least `amount`. */ function transfer(address recipient, uint256 amount) public virtual override returns (bool) { _transfer(_msgSender(), recipient, amount); return true; } /** * @dev See {IERC20-transfer}. * * Requirements: * * - `account` cannot be the zero address. * - the caller must have a balance of at least `amount`. */ function burn(uint256 amount) public virtual returns (bool) { _burn(_msgSender(), amount); return true; } function allowance(address owner, address spender) public view virtual override returns (uint256) { return _allowances[owner][spender]; } function approve(address spender, uint256 amount) public virtual override returns (bool) { _approve(_msgSender(), spender, amount); return true; } function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) { _transfer(sender, recipient, amount); _approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance")); return true; } function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue)); return true; } function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, "ERC20: decreased allowance below zero")); return true; } function _transfer(address sender, address recipient, uint256 amount) internal virtual { require(sender != address(0), "ERC20: transfer from the zero address"); require(recipient != address(0), "ERC20: transfer to the zero address"); uint256 amount_burn = amount.mul(_burnRate).div(100); uint256 amount_send = amount.sub(amount_burn); require(amount == amount_send + amount_burn, "Burn value invalid"); _burn(sender, amount_burn); amount = amount_send; _beforeTokenTransfer(sender, recipient, amount); _balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance"); _balances[recipient] = _balances[recipient].add(amount); emit Transfer(sender, recipient, amount); } function _mint(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: mint to the zero address"); _beforeTokenTransfer(address(0), account, amount); _totalSupply = _totalSupply.add(amount); _balances[account] = _balances[account].add(amount); emit Transfer(address(0), account, amount); } function _burn(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: burn from the zero address"); _beforeTokenTransfer(account, address(0), amount); _balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance"); _totalSupply = _totalSupply.sub(amount); _burnedSupply = _burnedSupply.add(amount); emit Transfer(account, address(0), amount); } function _approve(address owner, address spender, uint256 amount) internal virtual { require(owner != address(0), "ERC20: approve from the zero address"); require(spender != address(0), "ERC20: approve to the zero address"); _allowances[owner][spender] = amount; emit Approval(owner, spender, amount); } function _setupBurnrate(uint8 burnrate_) internal virtual { _burnRate = burnrate_; } function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual { } }
/** * @dev Implementation of the {IERC20} interface. * * This implementation is agnostic to the way tokens are created. This means * that a supply mechanism has to be added in a derived contract using {_mint}. * For a generic mechanism see {ERC20PresetMinterPauser}. * * TIP: For a detailed writeup see our guide * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How * to implement supply mechanisms]. * * We have followed general OpenZeppelin guidelines: functions revert instead * of returning `false` on failure. This behavior is nonetheless conventional * and does not conflict with the expectations of ERC20 applications. * * Additionally, an {Approval} event is emitted on calls to {transferFrom}. * This allows applications to reconstruct the allowance for all accounts just * by listening to said events. Other implementations of the EIP may not emit * these events, as it isn't required by the specification. * * Finally, the non-standard {decreaseAllowance} and {increaseAllowance} * functions have been added to mitigate the well-known issues around setting * allowances. See {IERC20-approve}. */
NatSpecMultiLine
decimals
function decimals() public view returns (uint256) { return _decimals; }
/** * @dev Returns the number of decimals used to get its user representation. * For example, if `decimals` equals `2`, a balance of `505` tokens should * be displayed to a user as `5,05` (`505 / 10 ** 2`). * * Tokens usually opt for a value of 18, imitating the relationship between * Ether and Wei. This is the value {ERC20} uses, unless {_setupDecimals} is * called. * * NOTE: This information is only used for _display_ purposes: it in * no way affects any of the arithmetic of the contract, including * {IERC20-balanceOf} and {IERC20-transfer}. */
NatSpecMultiLine
v0.6.12+commit.27d51765
GNU GPLv2
ipfs://2c46401db6fba9a9044d2a9ef4a783487fdd694901d8f835f40463f41db7374a
{ "func_code_index": [ 2129, 2219 ] }
2,065
CROWED
CROWED.sol
0x7216ae77b12fdcf250caff22b252bdeb3f188e35
Solidity
ERC20
contract ERC20 is Context, IERC20 { using SafeMath for uint256; using Address for address; mapping (address => uint256) private _balances; mapping (address => mapping (address => uint256)) private _allowances; uint256 private _totalSupply; uint256 private _burnedSupply; uint256 private _burnRate; string private _name; string private _symbol; uint256 private _decimals; /** * @dev Sets the values for {name} and {symbol}, initializes {decimals} with * a default value of 18. * * To select a different value for {decimals}, use {_setupDecimals}. * * All three of these values are immutable: they can only be set once during * construction. */ constructor (string memory name, string memory symbol, uint256 decimals, uint256 burnrate, uint256 initSupply) public { _name = name; _symbol = symbol; _decimals = decimals; _burnRate = burnrate; _totalSupply = 0; _mint(msg.sender, initSupply*(10**_decimals)); // initial 1000 SAIYAN tokens _burnedSupply = 0; } /** * @dev Returns the name of the token. */ function name() public view returns (string memory) { return _name; } /** * @dev Returns the symbol of the token, usually a shorter version of the * name. */ function symbol() public view returns (string memory) { return _symbol; } /** * @dev Returns the number of decimals used to get its user representation. * For example, if `decimals` equals `2`, a balance of `505` tokens should * be displayed to a user as `5,05` (`505 / 10 ** 2`). * * Tokens usually opt for a value of 18, imitating the relationship between * Ether and Wei. This is the value {ERC20} uses, unless {_setupDecimals} is * called. * * NOTE: This information is only used for _display_ purposes: it in * no way affects any of the arithmetic of the contract, including * {IERC20-balanceOf} and {IERC20-transfer}. */ function decimals() public view returns (uint256) { return _decimals; } /** * @dev See {IERC20-totalSupply}. */ function totalSupply() public view override returns (uint256) { return _totalSupply; } /** * @dev Returns the amount of burned tokens. */ function burnedSupply() public view returns (uint256) { return _burnedSupply; } /** * @dev Returns the burnrate. */ function burnRate() public view returns (uint256) { return _burnRate; } /** * @dev See {IERC20-balanceOf}. */ function balanceOf(address account) public view override returns (uint256) { return _balances[account]; } /** * @dev See {IERC20-transfer}. * * Requirements: * * - `recipient` cannot be the zero address. * - the caller must have a balance of at least `amount`. */ function transfer(address recipient, uint256 amount) public virtual override returns (bool) { _transfer(_msgSender(), recipient, amount); return true; } /** * @dev See {IERC20-transfer}. * * Requirements: * * - `account` cannot be the zero address. * - the caller must have a balance of at least `amount`. */ function burn(uint256 amount) public virtual returns (bool) { _burn(_msgSender(), amount); return true; } function allowance(address owner, address spender) public view virtual override returns (uint256) { return _allowances[owner][spender]; } function approve(address spender, uint256 amount) public virtual override returns (bool) { _approve(_msgSender(), spender, amount); return true; } function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) { _transfer(sender, recipient, amount); _approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance")); return true; } function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue)); return true; } function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, "ERC20: decreased allowance below zero")); return true; } function _transfer(address sender, address recipient, uint256 amount) internal virtual { require(sender != address(0), "ERC20: transfer from the zero address"); require(recipient != address(0), "ERC20: transfer to the zero address"); uint256 amount_burn = amount.mul(_burnRate).div(100); uint256 amount_send = amount.sub(amount_burn); require(amount == amount_send + amount_burn, "Burn value invalid"); _burn(sender, amount_burn); amount = amount_send; _beforeTokenTransfer(sender, recipient, amount); _balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance"); _balances[recipient] = _balances[recipient].add(amount); emit Transfer(sender, recipient, amount); } function _mint(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: mint to the zero address"); _beforeTokenTransfer(address(0), account, amount); _totalSupply = _totalSupply.add(amount); _balances[account] = _balances[account].add(amount); emit Transfer(address(0), account, amount); } function _burn(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: burn from the zero address"); _beforeTokenTransfer(account, address(0), amount); _balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance"); _totalSupply = _totalSupply.sub(amount); _burnedSupply = _burnedSupply.add(amount); emit Transfer(account, address(0), amount); } function _approve(address owner, address spender, uint256 amount) internal virtual { require(owner != address(0), "ERC20: approve from the zero address"); require(spender != address(0), "ERC20: approve to the zero address"); _allowances[owner][spender] = amount; emit Approval(owner, spender, amount); } function _setupBurnrate(uint8 burnrate_) internal virtual { _burnRate = burnrate_; } function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual { } }
/** * @dev Implementation of the {IERC20} interface. * * This implementation is agnostic to the way tokens are created. This means * that a supply mechanism has to be added in a derived contract using {_mint}. * For a generic mechanism see {ERC20PresetMinterPauser}. * * TIP: For a detailed writeup see our guide * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How * to implement supply mechanisms]. * * We have followed general OpenZeppelin guidelines: functions revert instead * of returning `false` on failure. This behavior is nonetheless conventional * and does not conflict with the expectations of ERC20 applications. * * Additionally, an {Approval} event is emitted on calls to {transferFrom}. * This allows applications to reconstruct the allowance for all accounts just * by listening to said events. Other implementations of the EIP may not emit * these events, as it isn't required by the specification. * * Finally, the non-standard {decreaseAllowance} and {increaseAllowance} * functions have been added to mitigate the well-known issues around setting * allowances. See {IERC20-approve}. */
NatSpecMultiLine
totalSupply
function totalSupply() public view override returns (uint256) { return _totalSupply; }
/** * @dev See {IERC20-totalSupply}. */
NatSpecMultiLine
v0.6.12+commit.27d51765
GNU GPLv2
ipfs://2c46401db6fba9a9044d2a9ef4a783487fdd694901d8f835f40463f41db7374a
{ "func_code_index": [ 2279, 2384 ] }
2,066
CROWED
CROWED.sol
0x7216ae77b12fdcf250caff22b252bdeb3f188e35
Solidity
ERC20
contract ERC20 is Context, IERC20 { using SafeMath for uint256; using Address for address; mapping (address => uint256) private _balances; mapping (address => mapping (address => uint256)) private _allowances; uint256 private _totalSupply; uint256 private _burnedSupply; uint256 private _burnRate; string private _name; string private _symbol; uint256 private _decimals; /** * @dev Sets the values for {name} and {symbol}, initializes {decimals} with * a default value of 18. * * To select a different value for {decimals}, use {_setupDecimals}. * * All three of these values are immutable: they can only be set once during * construction. */ constructor (string memory name, string memory symbol, uint256 decimals, uint256 burnrate, uint256 initSupply) public { _name = name; _symbol = symbol; _decimals = decimals; _burnRate = burnrate; _totalSupply = 0; _mint(msg.sender, initSupply*(10**_decimals)); // initial 1000 SAIYAN tokens _burnedSupply = 0; } /** * @dev Returns the name of the token. */ function name() public view returns (string memory) { return _name; } /** * @dev Returns the symbol of the token, usually a shorter version of the * name. */ function symbol() public view returns (string memory) { return _symbol; } /** * @dev Returns the number of decimals used to get its user representation. * For example, if `decimals` equals `2`, a balance of `505` tokens should * be displayed to a user as `5,05` (`505 / 10 ** 2`). * * Tokens usually opt for a value of 18, imitating the relationship between * Ether and Wei. This is the value {ERC20} uses, unless {_setupDecimals} is * called. * * NOTE: This information is only used for _display_ purposes: it in * no way affects any of the arithmetic of the contract, including * {IERC20-balanceOf} and {IERC20-transfer}. */ function decimals() public view returns (uint256) { return _decimals; } /** * @dev See {IERC20-totalSupply}. */ function totalSupply() public view override returns (uint256) { return _totalSupply; } /** * @dev Returns the amount of burned tokens. */ function burnedSupply() public view returns (uint256) { return _burnedSupply; } /** * @dev Returns the burnrate. */ function burnRate() public view returns (uint256) { return _burnRate; } /** * @dev See {IERC20-balanceOf}. */ function balanceOf(address account) public view override returns (uint256) { return _balances[account]; } /** * @dev See {IERC20-transfer}. * * Requirements: * * - `recipient` cannot be the zero address. * - the caller must have a balance of at least `amount`. */ function transfer(address recipient, uint256 amount) public virtual override returns (bool) { _transfer(_msgSender(), recipient, amount); return true; } /** * @dev See {IERC20-transfer}. * * Requirements: * * - `account` cannot be the zero address. * - the caller must have a balance of at least `amount`. */ function burn(uint256 amount) public virtual returns (bool) { _burn(_msgSender(), amount); return true; } function allowance(address owner, address spender) public view virtual override returns (uint256) { return _allowances[owner][spender]; } function approve(address spender, uint256 amount) public virtual override returns (bool) { _approve(_msgSender(), spender, amount); return true; } function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) { _transfer(sender, recipient, amount); _approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance")); return true; } function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue)); return true; } function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, "ERC20: decreased allowance below zero")); return true; } function _transfer(address sender, address recipient, uint256 amount) internal virtual { require(sender != address(0), "ERC20: transfer from the zero address"); require(recipient != address(0), "ERC20: transfer to the zero address"); uint256 amount_burn = amount.mul(_burnRate).div(100); uint256 amount_send = amount.sub(amount_burn); require(amount == amount_send + amount_burn, "Burn value invalid"); _burn(sender, amount_burn); amount = amount_send; _beforeTokenTransfer(sender, recipient, amount); _balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance"); _balances[recipient] = _balances[recipient].add(amount); emit Transfer(sender, recipient, amount); } function _mint(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: mint to the zero address"); _beforeTokenTransfer(address(0), account, amount); _totalSupply = _totalSupply.add(amount); _balances[account] = _balances[account].add(amount); emit Transfer(address(0), account, amount); } function _burn(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: burn from the zero address"); _beforeTokenTransfer(account, address(0), amount); _balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance"); _totalSupply = _totalSupply.sub(amount); _burnedSupply = _burnedSupply.add(amount); emit Transfer(account, address(0), amount); } function _approve(address owner, address spender, uint256 amount) internal virtual { require(owner != address(0), "ERC20: approve from the zero address"); require(spender != address(0), "ERC20: approve to the zero address"); _allowances[owner][spender] = amount; emit Approval(owner, spender, amount); } function _setupBurnrate(uint8 burnrate_) internal virtual { _burnRate = burnrate_; } function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual { } }
/** * @dev Implementation of the {IERC20} interface. * * This implementation is agnostic to the way tokens are created. This means * that a supply mechanism has to be added in a derived contract using {_mint}. * For a generic mechanism see {ERC20PresetMinterPauser}. * * TIP: For a detailed writeup see our guide * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How * to implement supply mechanisms]. * * We have followed general OpenZeppelin guidelines: functions revert instead * of returning `false` on failure. This behavior is nonetheless conventional * and does not conflict with the expectations of ERC20 applications. * * Additionally, an {Approval} event is emitted on calls to {transferFrom}. * This allows applications to reconstruct the allowance for all accounts just * by listening to said events. Other implementations of the EIP may not emit * these events, as it isn't required by the specification. * * Finally, the non-standard {decreaseAllowance} and {increaseAllowance} * functions have been added to mitigate the well-known issues around setting * allowances. See {IERC20-approve}. */
NatSpecMultiLine
burnedSupply
function burnedSupply() public view returns (uint256) { return _burnedSupply; }
/** * @dev Returns the amount of burned tokens. */
NatSpecMultiLine
v0.6.12+commit.27d51765
GNU GPLv2
ipfs://2c46401db6fba9a9044d2a9ef4a783487fdd694901d8f835f40463f41db7374a
{ "func_code_index": [ 2455, 2553 ] }
2,067
CROWED
CROWED.sol
0x7216ae77b12fdcf250caff22b252bdeb3f188e35
Solidity
ERC20
contract ERC20 is Context, IERC20 { using SafeMath for uint256; using Address for address; mapping (address => uint256) private _balances; mapping (address => mapping (address => uint256)) private _allowances; uint256 private _totalSupply; uint256 private _burnedSupply; uint256 private _burnRate; string private _name; string private _symbol; uint256 private _decimals; /** * @dev Sets the values for {name} and {symbol}, initializes {decimals} with * a default value of 18. * * To select a different value for {decimals}, use {_setupDecimals}. * * All three of these values are immutable: they can only be set once during * construction. */ constructor (string memory name, string memory symbol, uint256 decimals, uint256 burnrate, uint256 initSupply) public { _name = name; _symbol = symbol; _decimals = decimals; _burnRate = burnrate; _totalSupply = 0; _mint(msg.sender, initSupply*(10**_decimals)); // initial 1000 SAIYAN tokens _burnedSupply = 0; } /** * @dev Returns the name of the token. */ function name() public view returns (string memory) { return _name; } /** * @dev Returns the symbol of the token, usually a shorter version of the * name. */ function symbol() public view returns (string memory) { return _symbol; } /** * @dev Returns the number of decimals used to get its user representation. * For example, if `decimals` equals `2`, a balance of `505` tokens should * be displayed to a user as `5,05` (`505 / 10 ** 2`). * * Tokens usually opt for a value of 18, imitating the relationship between * Ether and Wei. This is the value {ERC20} uses, unless {_setupDecimals} is * called. * * NOTE: This information is only used for _display_ purposes: it in * no way affects any of the arithmetic of the contract, including * {IERC20-balanceOf} and {IERC20-transfer}. */ function decimals() public view returns (uint256) { return _decimals; } /** * @dev See {IERC20-totalSupply}. */ function totalSupply() public view override returns (uint256) { return _totalSupply; } /** * @dev Returns the amount of burned tokens. */ function burnedSupply() public view returns (uint256) { return _burnedSupply; } /** * @dev Returns the burnrate. */ function burnRate() public view returns (uint256) { return _burnRate; } /** * @dev See {IERC20-balanceOf}. */ function balanceOf(address account) public view override returns (uint256) { return _balances[account]; } /** * @dev See {IERC20-transfer}. * * Requirements: * * - `recipient` cannot be the zero address. * - the caller must have a balance of at least `amount`. */ function transfer(address recipient, uint256 amount) public virtual override returns (bool) { _transfer(_msgSender(), recipient, amount); return true; } /** * @dev See {IERC20-transfer}. * * Requirements: * * - `account` cannot be the zero address. * - the caller must have a balance of at least `amount`. */ function burn(uint256 amount) public virtual returns (bool) { _burn(_msgSender(), amount); return true; } function allowance(address owner, address spender) public view virtual override returns (uint256) { return _allowances[owner][spender]; } function approve(address spender, uint256 amount) public virtual override returns (bool) { _approve(_msgSender(), spender, amount); return true; } function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) { _transfer(sender, recipient, amount); _approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance")); return true; } function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue)); return true; } function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, "ERC20: decreased allowance below zero")); return true; } function _transfer(address sender, address recipient, uint256 amount) internal virtual { require(sender != address(0), "ERC20: transfer from the zero address"); require(recipient != address(0), "ERC20: transfer to the zero address"); uint256 amount_burn = amount.mul(_burnRate).div(100); uint256 amount_send = amount.sub(amount_burn); require(amount == amount_send + amount_burn, "Burn value invalid"); _burn(sender, amount_burn); amount = amount_send; _beforeTokenTransfer(sender, recipient, amount); _balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance"); _balances[recipient] = _balances[recipient].add(amount); emit Transfer(sender, recipient, amount); } function _mint(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: mint to the zero address"); _beforeTokenTransfer(address(0), account, amount); _totalSupply = _totalSupply.add(amount); _balances[account] = _balances[account].add(amount); emit Transfer(address(0), account, amount); } function _burn(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: burn from the zero address"); _beforeTokenTransfer(account, address(0), amount); _balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance"); _totalSupply = _totalSupply.sub(amount); _burnedSupply = _burnedSupply.add(amount); emit Transfer(account, address(0), amount); } function _approve(address owner, address spender, uint256 amount) internal virtual { require(owner != address(0), "ERC20: approve from the zero address"); require(spender != address(0), "ERC20: approve to the zero address"); _allowances[owner][spender] = amount; emit Approval(owner, spender, amount); } function _setupBurnrate(uint8 burnrate_) internal virtual { _burnRate = burnrate_; } function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual { } }
/** * @dev Implementation of the {IERC20} interface. * * This implementation is agnostic to the way tokens are created. This means * that a supply mechanism has to be added in a derived contract using {_mint}. * For a generic mechanism see {ERC20PresetMinterPauser}. * * TIP: For a detailed writeup see our guide * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How * to implement supply mechanisms]. * * We have followed general OpenZeppelin guidelines: functions revert instead * of returning `false` on failure. This behavior is nonetheless conventional * and does not conflict with the expectations of ERC20 applications. * * Additionally, an {Approval} event is emitted on calls to {transferFrom}. * This allows applications to reconstruct the allowance for all accounts just * by listening to said events. Other implementations of the EIP may not emit * these events, as it isn't required by the specification. * * Finally, the non-standard {decreaseAllowance} and {increaseAllowance} * functions have been added to mitigate the well-known issues around setting * allowances. See {IERC20-approve}. */
NatSpecMultiLine
burnRate
function burnRate() public view returns (uint256) { return _burnRate; }
/** * @dev Returns the burnrate. */
NatSpecMultiLine
v0.6.12+commit.27d51765
GNU GPLv2
ipfs://2c46401db6fba9a9044d2a9ef4a783487fdd694901d8f835f40463f41db7374a
{ "func_code_index": [ 2609, 2699 ] }
2,068
CROWED
CROWED.sol
0x7216ae77b12fdcf250caff22b252bdeb3f188e35
Solidity
ERC20
contract ERC20 is Context, IERC20 { using SafeMath for uint256; using Address for address; mapping (address => uint256) private _balances; mapping (address => mapping (address => uint256)) private _allowances; uint256 private _totalSupply; uint256 private _burnedSupply; uint256 private _burnRate; string private _name; string private _symbol; uint256 private _decimals; /** * @dev Sets the values for {name} and {symbol}, initializes {decimals} with * a default value of 18. * * To select a different value for {decimals}, use {_setupDecimals}. * * All three of these values are immutable: they can only be set once during * construction. */ constructor (string memory name, string memory symbol, uint256 decimals, uint256 burnrate, uint256 initSupply) public { _name = name; _symbol = symbol; _decimals = decimals; _burnRate = burnrate; _totalSupply = 0; _mint(msg.sender, initSupply*(10**_decimals)); // initial 1000 SAIYAN tokens _burnedSupply = 0; } /** * @dev Returns the name of the token. */ function name() public view returns (string memory) { return _name; } /** * @dev Returns the symbol of the token, usually a shorter version of the * name. */ function symbol() public view returns (string memory) { return _symbol; } /** * @dev Returns the number of decimals used to get its user representation. * For example, if `decimals` equals `2`, a balance of `505` tokens should * be displayed to a user as `5,05` (`505 / 10 ** 2`). * * Tokens usually opt for a value of 18, imitating the relationship between * Ether and Wei. This is the value {ERC20} uses, unless {_setupDecimals} is * called. * * NOTE: This information is only used for _display_ purposes: it in * no way affects any of the arithmetic of the contract, including * {IERC20-balanceOf} and {IERC20-transfer}. */ function decimals() public view returns (uint256) { return _decimals; } /** * @dev See {IERC20-totalSupply}. */ function totalSupply() public view override returns (uint256) { return _totalSupply; } /** * @dev Returns the amount of burned tokens. */ function burnedSupply() public view returns (uint256) { return _burnedSupply; } /** * @dev Returns the burnrate. */ function burnRate() public view returns (uint256) { return _burnRate; } /** * @dev See {IERC20-balanceOf}. */ function balanceOf(address account) public view override returns (uint256) { return _balances[account]; } /** * @dev See {IERC20-transfer}. * * Requirements: * * - `recipient` cannot be the zero address. * - the caller must have a balance of at least `amount`. */ function transfer(address recipient, uint256 amount) public virtual override returns (bool) { _transfer(_msgSender(), recipient, amount); return true; } /** * @dev See {IERC20-transfer}. * * Requirements: * * - `account` cannot be the zero address. * - the caller must have a balance of at least `amount`. */ function burn(uint256 amount) public virtual returns (bool) { _burn(_msgSender(), amount); return true; } function allowance(address owner, address spender) public view virtual override returns (uint256) { return _allowances[owner][spender]; } function approve(address spender, uint256 amount) public virtual override returns (bool) { _approve(_msgSender(), spender, amount); return true; } function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) { _transfer(sender, recipient, amount); _approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance")); return true; } function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue)); return true; } function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, "ERC20: decreased allowance below zero")); return true; } function _transfer(address sender, address recipient, uint256 amount) internal virtual { require(sender != address(0), "ERC20: transfer from the zero address"); require(recipient != address(0), "ERC20: transfer to the zero address"); uint256 amount_burn = amount.mul(_burnRate).div(100); uint256 amount_send = amount.sub(amount_burn); require(amount == amount_send + amount_burn, "Burn value invalid"); _burn(sender, amount_burn); amount = amount_send; _beforeTokenTransfer(sender, recipient, amount); _balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance"); _balances[recipient] = _balances[recipient].add(amount); emit Transfer(sender, recipient, amount); } function _mint(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: mint to the zero address"); _beforeTokenTransfer(address(0), account, amount); _totalSupply = _totalSupply.add(amount); _balances[account] = _balances[account].add(amount); emit Transfer(address(0), account, amount); } function _burn(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: burn from the zero address"); _beforeTokenTransfer(account, address(0), amount); _balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance"); _totalSupply = _totalSupply.sub(amount); _burnedSupply = _burnedSupply.add(amount); emit Transfer(account, address(0), amount); } function _approve(address owner, address spender, uint256 amount) internal virtual { require(owner != address(0), "ERC20: approve from the zero address"); require(spender != address(0), "ERC20: approve to the zero address"); _allowances[owner][spender] = amount; emit Approval(owner, spender, amount); } function _setupBurnrate(uint8 burnrate_) internal virtual { _burnRate = burnrate_; } function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual { } }
/** * @dev Implementation of the {IERC20} interface. * * This implementation is agnostic to the way tokens are created. This means * that a supply mechanism has to be added in a derived contract using {_mint}. * For a generic mechanism see {ERC20PresetMinterPauser}. * * TIP: For a detailed writeup see our guide * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How * to implement supply mechanisms]. * * We have followed general OpenZeppelin guidelines: functions revert instead * of returning `false` on failure. This behavior is nonetheless conventional * and does not conflict with the expectations of ERC20 applications. * * Additionally, an {Approval} event is emitted on calls to {transferFrom}. * This allows applications to reconstruct the allowance for all accounts just * by listening to said events. Other implementations of the EIP may not emit * these events, as it isn't required by the specification. * * Finally, the non-standard {decreaseAllowance} and {increaseAllowance} * functions have been added to mitigate the well-known issues around setting * allowances. See {IERC20-approve}. */
NatSpecMultiLine
balanceOf
function balanceOf(address account) public view override returns (uint256) { return _balances[account]; }
/** * @dev See {IERC20-balanceOf}. */
NatSpecMultiLine
v0.6.12+commit.27d51765
GNU GPLv2
ipfs://2c46401db6fba9a9044d2a9ef4a783487fdd694901d8f835f40463f41db7374a
{ "func_code_index": [ 2757, 2881 ] }
2,069
CROWED
CROWED.sol
0x7216ae77b12fdcf250caff22b252bdeb3f188e35
Solidity
ERC20
contract ERC20 is Context, IERC20 { using SafeMath for uint256; using Address for address; mapping (address => uint256) private _balances; mapping (address => mapping (address => uint256)) private _allowances; uint256 private _totalSupply; uint256 private _burnedSupply; uint256 private _burnRate; string private _name; string private _symbol; uint256 private _decimals; /** * @dev Sets the values for {name} and {symbol}, initializes {decimals} with * a default value of 18. * * To select a different value for {decimals}, use {_setupDecimals}. * * All three of these values are immutable: they can only be set once during * construction. */ constructor (string memory name, string memory symbol, uint256 decimals, uint256 burnrate, uint256 initSupply) public { _name = name; _symbol = symbol; _decimals = decimals; _burnRate = burnrate; _totalSupply = 0; _mint(msg.sender, initSupply*(10**_decimals)); // initial 1000 SAIYAN tokens _burnedSupply = 0; } /** * @dev Returns the name of the token. */ function name() public view returns (string memory) { return _name; } /** * @dev Returns the symbol of the token, usually a shorter version of the * name. */ function symbol() public view returns (string memory) { return _symbol; } /** * @dev Returns the number of decimals used to get its user representation. * For example, if `decimals` equals `2`, a balance of `505` tokens should * be displayed to a user as `5,05` (`505 / 10 ** 2`). * * Tokens usually opt for a value of 18, imitating the relationship between * Ether and Wei. This is the value {ERC20} uses, unless {_setupDecimals} is * called. * * NOTE: This information is only used for _display_ purposes: it in * no way affects any of the arithmetic of the contract, including * {IERC20-balanceOf} and {IERC20-transfer}. */ function decimals() public view returns (uint256) { return _decimals; } /** * @dev See {IERC20-totalSupply}. */ function totalSupply() public view override returns (uint256) { return _totalSupply; } /** * @dev Returns the amount of burned tokens. */ function burnedSupply() public view returns (uint256) { return _burnedSupply; } /** * @dev Returns the burnrate. */ function burnRate() public view returns (uint256) { return _burnRate; } /** * @dev See {IERC20-balanceOf}. */ function balanceOf(address account) public view override returns (uint256) { return _balances[account]; } /** * @dev See {IERC20-transfer}. * * Requirements: * * - `recipient` cannot be the zero address. * - the caller must have a balance of at least `amount`. */ function transfer(address recipient, uint256 amount) public virtual override returns (bool) { _transfer(_msgSender(), recipient, amount); return true; } /** * @dev See {IERC20-transfer}. * * Requirements: * * - `account` cannot be the zero address. * - the caller must have a balance of at least `amount`. */ function burn(uint256 amount) public virtual returns (bool) { _burn(_msgSender(), amount); return true; } function allowance(address owner, address spender) public view virtual override returns (uint256) { return _allowances[owner][spender]; } function approve(address spender, uint256 amount) public virtual override returns (bool) { _approve(_msgSender(), spender, amount); return true; } function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) { _transfer(sender, recipient, amount); _approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance")); return true; } function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue)); return true; } function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, "ERC20: decreased allowance below zero")); return true; } function _transfer(address sender, address recipient, uint256 amount) internal virtual { require(sender != address(0), "ERC20: transfer from the zero address"); require(recipient != address(0), "ERC20: transfer to the zero address"); uint256 amount_burn = amount.mul(_burnRate).div(100); uint256 amount_send = amount.sub(amount_burn); require(amount == amount_send + amount_burn, "Burn value invalid"); _burn(sender, amount_burn); amount = amount_send; _beforeTokenTransfer(sender, recipient, amount); _balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance"); _balances[recipient] = _balances[recipient].add(amount); emit Transfer(sender, recipient, amount); } function _mint(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: mint to the zero address"); _beforeTokenTransfer(address(0), account, amount); _totalSupply = _totalSupply.add(amount); _balances[account] = _balances[account].add(amount); emit Transfer(address(0), account, amount); } function _burn(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: burn from the zero address"); _beforeTokenTransfer(account, address(0), amount); _balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance"); _totalSupply = _totalSupply.sub(amount); _burnedSupply = _burnedSupply.add(amount); emit Transfer(account, address(0), amount); } function _approve(address owner, address spender, uint256 amount) internal virtual { require(owner != address(0), "ERC20: approve from the zero address"); require(spender != address(0), "ERC20: approve to the zero address"); _allowances[owner][spender] = amount; emit Approval(owner, spender, amount); } function _setupBurnrate(uint8 burnrate_) internal virtual { _burnRate = burnrate_; } function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual { } }
/** * @dev Implementation of the {IERC20} interface. * * This implementation is agnostic to the way tokens are created. This means * that a supply mechanism has to be added in a derived contract using {_mint}. * For a generic mechanism see {ERC20PresetMinterPauser}. * * TIP: For a detailed writeup see our guide * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How * to implement supply mechanisms]. * * We have followed general OpenZeppelin guidelines: functions revert instead * of returning `false` on failure. This behavior is nonetheless conventional * and does not conflict with the expectations of ERC20 applications. * * Additionally, an {Approval} event is emitted on calls to {transferFrom}. * This allows applications to reconstruct the allowance for all accounts just * by listening to said events. Other implementations of the EIP may not emit * these events, as it isn't required by the specification. * * Finally, the non-standard {decreaseAllowance} and {increaseAllowance} * functions have been added to mitigate the well-known issues around setting * allowances. See {IERC20-approve}. */
NatSpecMultiLine
transfer
function transfer(address recipient, uint256 amount) public virtual override returns (bool) { _transfer(_msgSender(), recipient, amount); return true; }
/** * @dev See {IERC20-transfer}. * * Requirements: * * - `recipient` cannot be the zero address. * - the caller must have a balance of at least `amount`. */
NatSpecMultiLine
v0.6.12+commit.27d51765
GNU GPLv2
ipfs://2c46401db6fba9a9044d2a9ef4a783487fdd694901d8f835f40463f41db7374a
{ "func_code_index": [ 3089, 3269 ] }
2,070
CROWED
CROWED.sol
0x7216ae77b12fdcf250caff22b252bdeb3f188e35
Solidity
ERC20
contract ERC20 is Context, IERC20 { using SafeMath for uint256; using Address for address; mapping (address => uint256) private _balances; mapping (address => mapping (address => uint256)) private _allowances; uint256 private _totalSupply; uint256 private _burnedSupply; uint256 private _burnRate; string private _name; string private _symbol; uint256 private _decimals; /** * @dev Sets the values for {name} and {symbol}, initializes {decimals} with * a default value of 18. * * To select a different value for {decimals}, use {_setupDecimals}. * * All three of these values are immutable: they can only be set once during * construction. */ constructor (string memory name, string memory symbol, uint256 decimals, uint256 burnrate, uint256 initSupply) public { _name = name; _symbol = symbol; _decimals = decimals; _burnRate = burnrate; _totalSupply = 0; _mint(msg.sender, initSupply*(10**_decimals)); // initial 1000 SAIYAN tokens _burnedSupply = 0; } /** * @dev Returns the name of the token. */ function name() public view returns (string memory) { return _name; } /** * @dev Returns the symbol of the token, usually a shorter version of the * name. */ function symbol() public view returns (string memory) { return _symbol; } /** * @dev Returns the number of decimals used to get its user representation. * For example, if `decimals` equals `2`, a balance of `505` tokens should * be displayed to a user as `5,05` (`505 / 10 ** 2`). * * Tokens usually opt for a value of 18, imitating the relationship between * Ether and Wei. This is the value {ERC20} uses, unless {_setupDecimals} is * called. * * NOTE: This information is only used for _display_ purposes: it in * no way affects any of the arithmetic of the contract, including * {IERC20-balanceOf} and {IERC20-transfer}. */ function decimals() public view returns (uint256) { return _decimals; } /** * @dev See {IERC20-totalSupply}. */ function totalSupply() public view override returns (uint256) { return _totalSupply; } /** * @dev Returns the amount of burned tokens. */ function burnedSupply() public view returns (uint256) { return _burnedSupply; } /** * @dev Returns the burnrate. */ function burnRate() public view returns (uint256) { return _burnRate; } /** * @dev See {IERC20-balanceOf}. */ function balanceOf(address account) public view override returns (uint256) { return _balances[account]; } /** * @dev See {IERC20-transfer}. * * Requirements: * * - `recipient` cannot be the zero address. * - the caller must have a balance of at least `amount`. */ function transfer(address recipient, uint256 amount) public virtual override returns (bool) { _transfer(_msgSender(), recipient, amount); return true; } /** * @dev See {IERC20-transfer}. * * Requirements: * * - `account` cannot be the zero address. * - the caller must have a balance of at least `amount`. */ function burn(uint256 amount) public virtual returns (bool) { _burn(_msgSender(), amount); return true; } function allowance(address owner, address spender) public view virtual override returns (uint256) { return _allowances[owner][spender]; } function approve(address spender, uint256 amount) public virtual override returns (bool) { _approve(_msgSender(), spender, amount); return true; } function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) { _transfer(sender, recipient, amount); _approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance")); return true; } function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue)); return true; } function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, "ERC20: decreased allowance below zero")); return true; } function _transfer(address sender, address recipient, uint256 amount) internal virtual { require(sender != address(0), "ERC20: transfer from the zero address"); require(recipient != address(0), "ERC20: transfer to the zero address"); uint256 amount_burn = amount.mul(_burnRate).div(100); uint256 amount_send = amount.sub(amount_burn); require(amount == amount_send + amount_burn, "Burn value invalid"); _burn(sender, amount_burn); amount = amount_send; _beforeTokenTransfer(sender, recipient, amount); _balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance"); _balances[recipient] = _balances[recipient].add(amount); emit Transfer(sender, recipient, amount); } function _mint(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: mint to the zero address"); _beforeTokenTransfer(address(0), account, amount); _totalSupply = _totalSupply.add(amount); _balances[account] = _balances[account].add(amount); emit Transfer(address(0), account, amount); } function _burn(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: burn from the zero address"); _beforeTokenTransfer(account, address(0), amount); _balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance"); _totalSupply = _totalSupply.sub(amount); _burnedSupply = _burnedSupply.add(amount); emit Transfer(account, address(0), amount); } function _approve(address owner, address spender, uint256 amount) internal virtual { require(owner != address(0), "ERC20: approve from the zero address"); require(spender != address(0), "ERC20: approve to the zero address"); _allowances[owner][spender] = amount; emit Approval(owner, spender, amount); } function _setupBurnrate(uint8 burnrate_) internal virtual { _burnRate = burnrate_; } function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual { } }
/** * @dev Implementation of the {IERC20} interface. * * This implementation is agnostic to the way tokens are created. This means * that a supply mechanism has to be added in a derived contract using {_mint}. * For a generic mechanism see {ERC20PresetMinterPauser}. * * TIP: For a detailed writeup see our guide * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How * to implement supply mechanisms]. * * We have followed general OpenZeppelin guidelines: functions revert instead * of returning `false` on failure. This behavior is nonetheless conventional * and does not conflict with the expectations of ERC20 applications. * * Additionally, an {Approval} event is emitted on calls to {transferFrom}. * This allows applications to reconstruct the allowance for all accounts just * by listening to said events. Other implementations of the EIP may not emit * these events, as it isn't required by the specification. * * Finally, the non-standard {decreaseAllowance} and {increaseAllowance} * functions have been added to mitigate the well-known issues around setting * allowances. See {IERC20-approve}. */
NatSpecMultiLine
burn
function burn(uint256 amount) public virtual returns (bool) { _burn(_msgSender(), amount); return true; }
/** * @dev See {IERC20-transfer}. * * Requirements: * * - `account` cannot be the zero address. * - the caller must have a balance of at least `amount`. */
NatSpecMultiLine
v0.6.12+commit.27d51765
GNU GPLv2
ipfs://2c46401db6fba9a9044d2a9ef4a783487fdd694901d8f835f40463f41db7374a
{ "func_code_index": [ 3475, 3608 ] }
2,071
Token
Token.sol
0xfb28540d3d8d395ea2951bd3c83034b20c2225c0
Solidity
ERC20
interface ERC20 { //Methods function totalSupply() external view returns (uint256); function balanceOf(address account) external view returns (uint256); function allowance(address owner, address spender) external view returns (uint256); function transfer(address recipient, uint256 amount) external returns (bool); function approve(address spender, uint256 amount) external returns (bool); function transferFrom(address sender, address recipient, uint256 amount) external returns (bool); //Events event Transfer(address indexed from, address indexed to, uint256 value); event Approval(address indexed owner, address indexed spender, uint256 value); }
totalSupply
function totalSupply() external view returns (uint256);
//Methods
LineComment
v0.8.6+commit.11564f7e
MIT
{ "func_code_index": [ 34, 93 ] }
2,072
Bexpress
Bexpress.sol
0xc002141f62961afa759f7b22aaeb151bf80a3d8d
Solidity
SafeMath
library SafeMath { /** * @dev Multiplies two unsigned integers, reverts on overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522 if (a == 0) { return 0; } uint256 c = a * b; require(c / a == b); return c; } /** * @dev Integer division of two unsigned integers truncating the quotient, reverts on division by zero. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { // Solidity only automatically asserts when dividing by 0 require(b > 0); uint256 c = a / b; // assert(a == b * c + a % b); // There is no case in which this doesn't hold return c; } /** * @dev Subtracts two unsigned integers, reverts on overflow (i.e. if subtrahend is greater than minuend). */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { require(b <= a); uint256 c = a - b; return c; } /** * @dev Adds two unsigned integers, reverts on overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; require(c >= a); return c; } /** * @dev Divides two unsigned integers and returns the remainder (unsigned integer modulo), * reverts when dividing by zero. */ function mod(uint256 a, uint256 b) internal pure returns (uint256) { require(b != 0); return a % b; } }
/** * @title SafeMath * @dev Unsigned math operations with safety checks that revert on error */
NatSpecMultiLine
mul
function mul(uint256 a, uint256 b) internal pure returns (uint256) { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522 if (a == 0) { return 0; } uint256 c = a * b; require(c / a == b); return c; }
/** * @dev Multiplies two unsigned integers, reverts on overflow. */
NatSpecMultiLine
v0.5.17+commit.d19bba13
None
bzzr://cfefed105a08f450eba1a193f0c7cb37af76c84c4dc3c10269331305bff11870
{ "func_code_index": [ 106, 544 ] }
2,073
Bexpress
Bexpress.sol
0xc002141f62961afa759f7b22aaeb151bf80a3d8d
Solidity
SafeMath
library SafeMath { /** * @dev Multiplies two unsigned integers, reverts on overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522 if (a == 0) { return 0; } uint256 c = a * b; require(c / a == b); return c; } /** * @dev Integer division of two unsigned integers truncating the quotient, reverts on division by zero. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { // Solidity only automatically asserts when dividing by 0 require(b > 0); uint256 c = a / b; // assert(a == b * c + a % b); // There is no case in which this doesn't hold return c; } /** * @dev Subtracts two unsigned integers, reverts on overflow (i.e. if subtrahend is greater than minuend). */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { require(b <= a); uint256 c = a - b; return c; } /** * @dev Adds two unsigned integers, reverts on overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; require(c >= a); return c; } /** * @dev Divides two unsigned integers and returns the remainder (unsigned integer modulo), * reverts when dividing by zero. */ function mod(uint256 a, uint256 b) internal pure returns (uint256) { require(b != 0); return a % b; } }
/** * @title SafeMath * @dev Unsigned math operations with safety checks that revert on error */
NatSpecMultiLine
div
function div(uint256 a, uint256 b) internal pure returns (uint256) { // Solidity only automatically asserts when dividing by 0 require(b > 0); uint256 c = a / b; // assert(a == b * c + a % b); // There is no case in which this doesn't hold return c; }
/** * @dev Integer division of two unsigned integers truncating the quotient, reverts on division by zero. */
NatSpecMultiLine
v0.5.17+commit.d19bba13
None
bzzr://cfefed105a08f450eba1a193f0c7cb37af76c84c4dc3c10269331305bff11870
{ "func_code_index": [ 674, 982 ] }
2,074
Bexpress
Bexpress.sol
0xc002141f62961afa759f7b22aaeb151bf80a3d8d
Solidity
SafeMath
library SafeMath { /** * @dev Multiplies two unsigned integers, reverts on overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522 if (a == 0) { return 0; } uint256 c = a * b; require(c / a == b); return c; } /** * @dev Integer division of two unsigned integers truncating the quotient, reverts on division by zero. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { // Solidity only automatically asserts when dividing by 0 require(b > 0); uint256 c = a / b; // assert(a == b * c + a % b); // There is no case in which this doesn't hold return c; } /** * @dev Subtracts two unsigned integers, reverts on overflow (i.e. if subtrahend is greater than minuend). */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { require(b <= a); uint256 c = a - b; return c; } /** * @dev Adds two unsigned integers, reverts on overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; require(c >= a); return c; } /** * @dev Divides two unsigned integers and returns the remainder (unsigned integer modulo), * reverts when dividing by zero. */ function mod(uint256 a, uint256 b) internal pure returns (uint256) { require(b != 0); return a % b; } }
/** * @title SafeMath * @dev Unsigned math operations with safety checks that revert on error */
NatSpecMultiLine
sub
function sub(uint256 a, uint256 b) internal pure returns (uint256) { require(b <= a); uint256 c = a - b; return c; }
/** * @dev Subtracts two unsigned integers, reverts on overflow (i.e. if subtrahend is greater than minuend). */
NatSpecMultiLine
v0.5.17+commit.d19bba13
None
bzzr://cfefed105a08f450eba1a193f0c7cb37af76c84c4dc3c10269331305bff11870
{ "func_code_index": [ 1115, 1270 ] }
2,075
Bexpress
Bexpress.sol
0xc002141f62961afa759f7b22aaeb151bf80a3d8d
Solidity
SafeMath
library SafeMath { /** * @dev Multiplies two unsigned integers, reverts on overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522 if (a == 0) { return 0; } uint256 c = a * b; require(c / a == b); return c; } /** * @dev Integer division of two unsigned integers truncating the quotient, reverts on division by zero. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { // Solidity only automatically asserts when dividing by 0 require(b > 0); uint256 c = a / b; // assert(a == b * c + a % b); // There is no case in which this doesn't hold return c; } /** * @dev Subtracts two unsigned integers, reverts on overflow (i.e. if subtrahend is greater than minuend). */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { require(b <= a); uint256 c = a - b; return c; } /** * @dev Adds two unsigned integers, reverts on overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; require(c >= a); return c; } /** * @dev Divides two unsigned integers and returns the remainder (unsigned integer modulo), * reverts when dividing by zero. */ function mod(uint256 a, uint256 b) internal pure returns (uint256) { require(b != 0); return a % b; } }
/** * @title SafeMath * @dev Unsigned math operations with safety checks that revert on error */
NatSpecMultiLine
add
function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; require(c >= a); return c; }
/** * @dev Adds two unsigned integers, reverts on overflow. */
NatSpecMultiLine
v0.5.17+commit.d19bba13
None
bzzr://cfefed105a08f450eba1a193f0c7cb37af76c84c4dc3c10269331305bff11870
{ "func_code_index": [ 1353, 1508 ] }
2,076
Bexpress
Bexpress.sol
0xc002141f62961afa759f7b22aaeb151bf80a3d8d
Solidity
SafeMath
library SafeMath { /** * @dev Multiplies two unsigned integers, reverts on overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522 if (a == 0) { return 0; } uint256 c = a * b; require(c / a == b); return c; } /** * @dev Integer division of two unsigned integers truncating the quotient, reverts on division by zero. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { // Solidity only automatically asserts when dividing by 0 require(b > 0); uint256 c = a / b; // assert(a == b * c + a % b); // There is no case in which this doesn't hold return c; } /** * @dev Subtracts two unsigned integers, reverts on overflow (i.e. if subtrahend is greater than minuend). */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { require(b <= a); uint256 c = a - b; return c; } /** * @dev Adds two unsigned integers, reverts on overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; require(c >= a); return c; } /** * @dev Divides two unsigned integers and returns the remainder (unsigned integer modulo), * reverts when dividing by zero. */ function mod(uint256 a, uint256 b) internal pure returns (uint256) { require(b != 0); return a % b; } }
/** * @title SafeMath * @dev Unsigned math operations with safety checks that revert on error */
NatSpecMultiLine
mod
function mod(uint256 a, uint256 b) internal pure returns (uint256) { require(b != 0); return a % b; }
/** * @dev Divides two unsigned integers and returns the remainder (unsigned integer modulo), * reverts when dividing by zero. */
NatSpecMultiLine
v0.5.17+commit.d19bba13
None
bzzr://cfefed105a08f450eba1a193f0c7cb37af76c84c4dc3c10269331305bff11870
{ "func_code_index": [ 1664, 1793 ] }
2,077
Bexpress
Bexpress.sol
0xc002141f62961afa759f7b22aaeb151bf80a3d8d
Solidity
ERC20
contract ERC20 is IERC20 { using SafeMath for uint256; mapping(address => uint256) private _balances; mapping(address => mapping(address => uint256)) private _allowed; uint256 private _totalSupply; /** * @dev Total number of tokens in existence */ function totalSupply() public view returns (uint256) { return _totalSupply; } /** * @dev Gets the balance of the specified address. * @param owner The address to query the balance of. * @return An uint256 representing the amount owned by the passed address. */ function balanceOf(address owner) public view returns (uint256) { return _balances[owner]; } /** * @dev Function to check the amount of tokens that an owner allowed to a spender. * @param owner address The address which owns the funds. * @param spender address The address which will spend the funds. * @return A uint256 specifying the amount of tokens still available for the spender. */ function allowance(address owner, address spender) public view returns (uint256) { return _allowed[owner][spender]; } /** * @dev Transfer token for a specified address * @param to The address to transfer to. * @param value The amount to be transferred. */ function transfer(address to, uint256 value) public returns (bool) { _transfer(msg.sender, to, value); return true; } /** * @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender. * Beware that changing an allowance with this method brings the risk that someone may use both the old * and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this * race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * @param spender The address which will spend the funds. * @param value The amount of tokens to be spent. */ function approve(address spender, uint256 value) public returns (bool) { require(spender != address(0)); _allowed[msg.sender][spender] = value; emit Approval(msg.sender, spender, value); return true; } /** * @dev Transfer tokens from one address to another. * Note that while this function emits an Approval event, this is not required as per the specification, * and other compliant implementations may not emit the event. * @param from address The address which you want to send tokens from * @param to address The address which you want to transfer to * @param value uint256 the amount of tokens to be transferred */ function transferFrom(address from, address to, uint256 value) public returns (bool) { _allowed[from][msg.sender] = _allowed[from][msg.sender].sub(value); _transfer(from, to, value); emit Approval(from, msg.sender, _allowed[from][msg.sender]); return true; } /** * @dev Increase the amount of tokens that an owner allowed to a spender. * approve should be called when allowed_[_spender] == 0. To increment * allowed value is better to use this function to avoid 2 calls (and wait until * the first transaction is mined) * From MonolithDAO Token.sol * Emits an Approval event. * @param spender The address which will spend the funds. * @param addedValue The amount of tokens to increase the allowance by. */ function increaseAllowance(address spender, uint256 addedValue) public returns (bool) { require(spender != address(0)); _allowed[msg.sender][spender] = _allowed[msg.sender][spender].add( addedValue ); emit Approval(msg.sender, spender, _allowed[msg.sender][spender]); return true; } /** * @dev Decrease the amount of tokens that an owner allowed to a spender. * approve should be called when allowed_[_spender] == 0. To decrement * allowed value is better to use this function to avoid 2 calls (and wait until * the first transaction is mined) * From MonolithDAO Token.sol * Emits an Approval event. * @param spender The address which will spend the funds. * @param subtractedValue The amount of tokens to decrease the allowance by. */ function decreaseAllowance(address spender, uint256 subtractedValue) public returns (bool) { require(spender != address(0)); _allowed[msg.sender][spender] = _allowed[msg.sender][spender].sub( subtractedValue ); emit Approval(msg.sender, spender, _allowed[msg.sender][spender]); return true; } /** * @dev Transfer token for a specified addresses * @param from The address to transfer from. * @param to The address to transfer to. * @param value The amount to be transferred. */ function _transfer(address from, address to, uint256 value) internal { require(to != address(0)); _balances[from] = _balances[from].sub(value); _balances[to] = _balances[to].add(value); emit Transfer(from, to, value); } /** * @dev Internal function that mints an amount of the token and assigns it to * an account. This encapsulates the modification of balances such that the * proper events are emitted. * @param value The amount that will be created. */ function _mint(uint256 value) internal { require(msg.sender != address(0)); _totalSupply = _totalSupply.add(value); _balances[msg.sender] = _balances[msg.sender].add(value); emit Transfer(address(0), msg.sender, value); } /** * @dev Internal function that burns an amount of the token of a given * account. * @param account The account whose tokens will be burnt. * @param value The amount that will be burnt. */ function _burn(address account, uint256 value) internal { require(account != address(0)); _totalSupply = _totalSupply.sub(value); _balances[account] = _balances[account].sub(value); emit Transfer(account, address(0), value); } /** * @dev Internal function that burns an amount of the token of a given * account, deducting from the sender's allowance for said account. Uses the * internal burn function. * Emits an Approval event (reflecting the reduced allowance). * @param account The account whose tokens will be burnt. * @param value The amount that will be burnt. */ function _burnFrom(address account, uint256 value) internal { _allowed[account][msg.sender] = _allowed[account][msg.sender].sub( value ); _burn(account, value); emit Approval(account, msg.sender, _allowed[account][msg.sender]); } }
/** * @title Standard ERC20 token * * @dev Implementation of the basic standard token. * https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20.md * Originally based on code by FirstBlood: * https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol * * This implementation emits additional Approval events, allowing applications to reconstruct the allowance status for * all accounts just by listening to said events. Note that this isn't required by the specification, and other * compliant implementations may not do it. */
NatSpecMultiLine
totalSupply
function totalSupply() public view returns (uint256) { return _totalSupply; }
/** * @dev Total number of tokens in existence */
NatSpecMultiLine
v0.5.17+commit.d19bba13
None
bzzr://cfefed105a08f450eba1a193f0c7cb37af76c84c4dc3c10269331305bff11870
{ "func_code_index": [ 294, 390 ] }
2,078
Bexpress
Bexpress.sol
0xc002141f62961afa759f7b22aaeb151bf80a3d8d
Solidity
ERC20
contract ERC20 is IERC20 { using SafeMath for uint256; mapping(address => uint256) private _balances; mapping(address => mapping(address => uint256)) private _allowed; uint256 private _totalSupply; /** * @dev Total number of tokens in existence */ function totalSupply() public view returns (uint256) { return _totalSupply; } /** * @dev Gets the balance of the specified address. * @param owner The address to query the balance of. * @return An uint256 representing the amount owned by the passed address. */ function balanceOf(address owner) public view returns (uint256) { return _balances[owner]; } /** * @dev Function to check the amount of tokens that an owner allowed to a spender. * @param owner address The address which owns the funds. * @param spender address The address which will spend the funds. * @return A uint256 specifying the amount of tokens still available for the spender. */ function allowance(address owner, address spender) public view returns (uint256) { return _allowed[owner][spender]; } /** * @dev Transfer token for a specified address * @param to The address to transfer to. * @param value The amount to be transferred. */ function transfer(address to, uint256 value) public returns (bool) { _transfer(msg.sender, to, value); return true; } /** * @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender. * Beware that changing an allowance with this method brings the risk that someone may use both the old * and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this * race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * @param spender The address which will spend the funds. * @param value The amount of tokens to be spent. */ function approve(address spender, uint256 value) public returns (bool) { require(spender != address(0)); _allowed[msg.sender][spender] = value; emit Approval(msg.sender, spender, value); return true; } /** * @dev Transfer tokens from one address to another. * Note that while this function emits an Approval event, this is not required as per the specification, * and other compliant implementations may not emit the event. * @param from address The address which you want to send tokens from * @param to address The address which you want to transfer to * @param value uint256 the amount of tokens to be transferred */ function transferFrom(address from, address to, uint256 value) public returns (bool) { _allowed[from][msg.sender] = _allowed[from][msg.sender].sub(value); _transfer(from, to, value); emit Approval(from, msg.sender, _allowed[from][msg.sender]); return true; } /** * @dev Increase the amount of tokens that an owner allowed to a spender. * approve should be called when allowed_[_spender] == 0. To increment * allowed value is better to use this function to avoid 2 calls (and wait until * the first transaction is mined) * From MonolithDAO Token.sol * Emits an Approval event. * @param spender The address which will spend the funds. * @param addedValue The amount of tokens to increase the allowance by. */ function increaseAllowance(address spender, uint256 addedValue) public returns (bool) { require(spender != address(0)); _allowed[msg.sender][spender] = _allowed[msg.sender][spender].add( addedValue ); emit Approval(msg.sender, spender, _allowed[msg.sender][spender]); return true; } /** * @dev Decrease the amount of tokens that an owner allowed to a spender. * approve should be called when allowed_[_spender] == 0. To decrement * allowed value is better to use this function to avoid 2 calls (and wait until * the first transaction is mined) * From MonolithDAO Token.sol * Emits an Approval event. * @param spender The address which will spend the funds. * @param subtractedValue The amount of tokens to decrease the allowance by. */ function decreaseAllowance(address spender, uint256 subtractedValue) public returns (bool) { require(spender != address(0)); _allowed[msg.sender][spender] = _allowed[msg.sender][spender].sub( subtractedValue ); emit Approval(msg.sender, spender, _allowed[msg.sender][spender]); return true; } /** * @dev Transfer token for a specified addresses * @param from The address to transfer from. * @param to The address to transfer to. * @param value The amount to be transferred. */ function _transfer(address from, address to, uint256 value) internal { require(to != address(0)); _balances[from] = _balances[from].sub(value); _balances[to] = _balances[to].add(value); emit Transfer(from, to, value); } /** * @dev Internal function that mints an amount of the token and assigns it to * an account. This encapsulates the modification of balances such that the * proper events are emitted. * @param value The amount that will be created. */ function _mint(uint256 value) internal { require(msg.sender != address(0)); _totalSupply = _totalSupply.add(value); _balances[msg.sender] = _balances[msg.sender].add(value); emit Transfer(address(0), msg.sender, value); } /** * @dev Internal function that burns an amount of the token of a given * account. * @param account The account whose tokens will be burnt. * @param value The amount that will be burnt. */ function _burn(address account, uint256 value) internal { require(account != address(0)); _totalSupply = _totalSupply.sub(value); _balances[account] = _balances[account].sub(value); emit Transfer(account, address(0), value); } /** * @dev Internal function that burns an amount of the token of a given * account, deducting from the sender's allowance for said account. Uses the * internal burn function. * Emits an Approval event (reflecting the reduced allowance). * @param account The account whose tokens will be burnt. * @param value The amount that will be burnt. */ function _burnFrom(address account, uint256 value) internal { _allowed[account][msg.sender] = _allowed[account][msg.sender].sub( value ); _burn(account, value); emit Approval(account, msg.sender, _allowed[account][msg.sender]); } }
/** * @title Standard ERC20 token * * @dev Implementation of the basic standard token. * https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20.md * Originally based on code by FirstBlood: * https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol * * This implementation emits additional Approval events, allowing applications to reconstruct the allowance status for * all accounts just by listening to said events. Note that this isn't required by the specification, and other * compliant implementations may not do it. */
NatSpecMultiLine
balanceOf
function balanceOf(address owner) public view returns (uint256) { return _balances[owner]; }
/** * @dev Gets the balance of the specified address. * @param owner The address to query the balance of. * @return An uint256 representing the amount owned by the passed address. */
NatSpecMultiLine
v0.5.17+commit.d19bba13
None
bzzr://cfefed105a08f450eba1a193f0c7cb37af76c84c4dc3c10269331305bff11870
{ "func_code_index": [ 605, 716 ] }
2,079
Bexpress
Bexpress.sol
0xc002141f62961afa759f7b22aaeb151bf80a3d8d
Solidity
ERC20
contract ERC20 is IERC20 { using SafeMath for uint256; mapping(address => uint256) private _balances; mapping(address => mapping(address => uint256)) private _allowed; uint256 private _totalSupply; /** * @dev Total number of tokens in existence */ function totalSupply() public view returns (uint256) { return _totalSupply; } /** * @dev Gets the balance of the specified address. * @param owner The address to query the balance of. * @return An uint256 representing the amount owned by the passed address. */ function balanceOf(address owner) public view returns (uint256) { return _balances[owner]; } /** * @dev Function to check the amount of tokens that an owner allowed to a spender. * @param owner address The address which owns the funds. * @param spender address The address which will spend the funds. * @return A uint256 specifying the amount of tokens still available for the spender. */ function allowance(address owner, address spender) public view returns (uint256) { return _allowed[owner][spender]; } /** * @dev Transfer token for a specified address * @param to The address to transfer to. * @param value The amount to be transferred. */ function transfer(address to, uint256 value) public returns (bool) { _transfer(msg.sender, to, value); return true; } /** * @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender. * Beware that changing an allowance with this method brings the risk that someone may use both the old * and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this * race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * @param spender The address which will spend the funds. * @param value The amount of tokens to be spent. */ function approve(address spender, uint256 value) public returns (bool) { require(spender != address(0)); _allowed[msg.sender][spender] = value; emit Approval(msg.sender, spender, value); return true; } /** * @dev Transfer tokens from one address to another. * Note that while this function emits an Approval event, this is not required as per the specification, * and other compliant implementations may not emit the event. * @param from address The address which you want to send tokens from * @param to address The address which you want to transfer to * @param value uint256 the amount of tokens to be transferred */ function transferFrom(address from, address to, uint256 value) public returns (bool) { _allowed[from][msg.sender] = _allowed[from][msg.sender].sub(value); _transfer(from, to, value); emit Approval(from, msg.sender, _allowed[from][msg.sender]); return true; } /** * @dev Increase the amount of tokens that an owner allowed to a spender. * approve should be called when allowed_[_spender] == 0. To increment * allowed value is better to use this function to avoid 2 calls (and wait until * the first transaction is mined) * From MonolithDAO Token.sol * Emits an Approval event. * @param spender The address which will spend the funds. * @param addedValue The amount of tokens to increase the allowance by. */ function increaseAllowance(address spender, uint256 addedValue) public returns (bool) { require(spender != address(0)); _allowed[msg.sender][spender] = _allowed[msg.sender][spender].add( addedValue ); emit Approval(msg.sender, spender, _allowed[msg.sender][spender]); return true; } /** * @dev Decrease the amount of tokens that an owner allowed to a spender. * approve should be called when allowed_[_spender] == 0. To decrement * allowed value is better to use this function to avoid 2 calls (and wait until * the first transaction is mined) * From MonolithDAO Token.sol * Emits an Approval event. * @param spender The address which will spend the funds. * @param subtractedValue The amount of tokens to decrease the allowance by. */ function decreaseAllowance(address spender, uint256 subtractedValue) public returns (bool) { require(spender != address(0)); _allowed[msg.sender][spender] = _allowed[msg.sender][spender].sub( subtractedValue ); emit Approval(msg.sender, spender, _allowed[msg.sender][spender]); return true; } /** * @dev Transfer token for a specified addresses * @param from The address to transfer from. * @param to The address to transfer to. * @param value The amount to be transferred. */ function _transfer(address from, address to, uint256 value) internal { require(to != address(0)); _balances[from] = _balances[from].sub(value); _balances[to] = _balances[to].add(value); emit Transfer(from, to, value); } /** * @dev Internal function that mints an amount of the token and assigns it to * an account. This encapsulates the modification of balances such that the * proper events are emitted. * @param value The amount that will be created. */ function _mint(uint256 value) internal { require(msg.sender != address(0)); _totalSupply = _totalSupply.add(value); _balances[msg.sender] = _balances[msg.sender].add(value); emit Transfer(address(0), msg.sender, value); } /** * @dev Internal function that burns an amount of the token of a given * account. * @param account The account whose tokens will be burnt. * @param value The amount that will be burnt. */ function _burn(address account, uint256 value) internal { require(account != address(0)); _totalSupply = _totalSupply.sub(value); _balances[account] = _balances[account].sub(value); emit Transfer(account, address(0), value); } /** * @dev Internal function that burns an amount of the token of a given * account, deducting from the sender's allowance for said account. Uses the * internal burn function. * Emits an Approval event (reflecting the reduced allowance). * @param account The account whose tokens will be burnt. * @param value The amount that will be burnt. */ function _burnFrom(address account, uint256 value) internal { _allowed[account][msg.sender] = _allowed[account][msg.sender].sub( value ); _burn(account, value); emit Approval(account, msg.sender, _allowed[account][msg.sender]); } }
/** * @title Standard ERC20 token * * @dev Implementation of the basic standard token. * https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20.md * Originally based on code by FirstBlood: * https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol * * This implementation emits additional Approval events, allowing applications to reconstruct the allowance status for * all accounts just by listening to said events. Note that this isn't required by the specification, and other * compliant implementations may not do it. */
NatSpecMultiLine
allowance
function allowance(address owner, address spender) public view returns (uint256) { return _allowed[owner][spender]; }
/** * @dev Function to check the amount of tokens that an owner allowed to a spender. * @param owner address The address which owns the funds. * @param spender address The address which will spend the funds. * @return A uint256 specifying the amount of tokens still available for the spender. */
NatSpecMultiLine
v0.5.17+commit.d19bba13
None
bzzr://cfefed105a08f450eba1a193f0c7cb37af76c84c4dc3c10269331305bff11870
{ "func_code_index": [ 1050, 1218 ] }
2,080
Bexpress
Bexpress.sol
0xc002141f62961afa759f7b22aaeb151bf80a3d8d
Solidity
ERC20
contract ERC20 is IERC20 { using SafeMath for uint256; mapping(address => uint256) private _balances; mapping(address => mapping(address => uint256)) private _allowed; uint256 private _totalSupply; /** * @dev Total number of tokens in existence */ function totalSupply() public view returns (uint256) { return _totalSupply; } /** * @dev Gets the balance of the specified address. * @param owner The address to query the balance of. * @return An uint256 representing the amount owned by the passed address. */ function balanceOf(address owner) public view returns (uint256) { return _balances[owner]; } /** * @dev Function to check the amount of tokens that an owner allowed to a spender. * @param owner address The address which owns the funds. * @param spender address The address which will spend the funds. * @return A uint256 specifying the amount of tokens still available for the spender. */ function allowance(address owner, address spender) public view returns (uint256) { return _allowed[owner][spender]; } /** * @dev Transfer token for a specified address * @param to The address to transfer to. * @param value The amount to be transferred. */ function transfer(address to, uint256 value) public returns (bool) { _transfer(msg.sender, to, value); return true; } /** * @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender. * Beware that changing an allowance with this method brings the risk that someone may use both the old * and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this * race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * @param spender The address which will spend the funds. * @param value The amount of tokens to be spent. */ function approve(address spender, uint256 value) public returns (bool) { require(spender != address(0)); _allowed[msg.sender][spender] = value; emit Approval(msg.sender, spender, value); return true; } /** * @dev Transfer tokens from one address to another. * Note that while this function emits an Approval event, this is not required as per the specification, * and other compliant implementations may not emit the event. * @param from address The address which you want to send tokens from * @param to address The address which you want to transfer to * @param value uint256 the amount of tokens to be transferred */ function transferFrom(address from, address to, uint256 value) public returns (bool) { _allowed[from][msg.sender] = _allowed[from][msg.sender].sub(value); _transfer(from, to, value); emit Approval(from, msg.sender, _allowed[from][msg.sender]); return true; } /** * @dev Increase the amount of tokens that an owner allowed to a spender. * approve should be called when allowed_[_spender] == 0. To increment * allowed value is better to use this function to avoid 2 calls (and wait until * the first transaction is mined) * From MonolithDAO Token.sol * Emits an Approval event. * @param spender The address which will spend the funds. * @param addedValue The amount of tokens to increase the allowance by. */ function increaseAllowance(address spender, uint256 addedValue) public returns (bool) { require(spender != address(0)); _allowed[msg.sender][spender] = _allowed[msg.sender][spender].add( addedValue ); emit Approval(msg.sender, spender, _allowed[msg.sender][spender]); return true; } /** * @dev Decrease the amount of tokens that an owner allowed to a spender. * approve should be called when allowed_[_spender] == 0. To decrement * allowed value is better to use this function to avoid 2 calls (and wait until * the first transaction is mined) * From MonolithDAO Token.sol * Emits an Approval event. * @param spender The address which will spend the funds. * @param subtractedValue The amount of tokens to decrease the allowance by. */ function decreaseAllowance(address spender, uint256 subtractedValue) public returns (bool) { require(spender != address(0)); _allowed[msg.sender][spender] = _allowed[msg.sender][spender].sub( subtractedValue ); emit Approval(msg.sender, spender, _allowed[msg.sender][spender]); return true; } /** * @dev Transfer token for a specified addresses * @param from The address to transfer from. * @param to The address to transfer to. * @param value The amount to be transferred. */ function _transfer(address from, address to, uint256 value) internal { require(to != address(0)); _balances[from] = _balances[from].sub(value); _balances[to] = _balances[to].add(value); emit Transfer(from, to, value); } /** * @dev Internal function that mints an amount of the token and assigns it to * an account. This encapsulates the modification of balances such that the * proper events are emitted. * @param value The amount that will be created. */ function _mint(uint256 value) internal { require(msg.sender != address(0)); _totalSupply = _totalSupply.add(value); _balances[msg.sender] = _balances[msg.sender].add(value); emit Transfer(address(0), msg.sender, value); } /** * @dev Internal function that burns an amount of the token of a given * account. * @param account The account whose tokens will be burnt. * @param value The amount that will be burnt. */ function _burn(address account, uint256 value) internal { require(account != address(0)); _totalSupply = _totalSupply.sub(value); _balances[account] = _balances[account].sub(value); emit Transfer(account, address(0), value); } /** * @dev Internal function that burns an amount of the token of a given * account, deducting from the sender's allowance for said account. Uses the * internal burn function. * Emits an Approval event (reflecting the reduced allowance). * @param account The account whose tokens will be burnt. * @param value The amount that will be burnt. */ function _burnFrom(address account, uint256 value) internal { _allowed[account][msg.sender] = _allowed[account][msg.sender].sub( value ); _burn(account, value); emit Approval(account, msg.sender, _allowed[account][msg.sender]); } }
/** * @title Standard ERC20 token * * @dev Implementation of the basic standard token. * https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20.md * Originally based on code by FirstBlood: * https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol * * This implementation emits additional Approval events, allowing applications to reconstruct the allowance status for * all accounts just by listening to said events. Note that this isn't required by the specification, and other * compliant implementations may not do it. */
NatSpecMultiLine
transfer
function transfer(address to, uint256 value) public returns (bool) { _transfer(msg.sender, to, value); return true; }
/** * @dev Transfer token for a specified address * @param to The address to transfer to. * @param value The amount to be transferred. */
NatSpecMultiLine
v0.5.17+commit.d19bba13
None
bzzr://cfefed105a08f450eba1a193f0c7cb37af76c84c4dc3c10269331305bff11870
{ "func_code_index": [ 1388, 1533 ] }
2,081
Bexpress
Bexpress.sol
0xc002141f62961afa759f7b22aaeb151bf80a3d8d
Solidity
ERC20
contract ERC20 is IERC20 { using SafeMath for uint256; mapping(address => uint256) private _balances; mapping(address => mapping(address => uint256)) private _allowed; uint256 private _totalSupply; /** * @dev Total number of tokens in existence */ function totalSupply() public view returns (uint256) { return _totalSupply; } /** * @dev Gets the balance of the specified address. * @param owner The address to query the balance of. * @return An uint256 representing the amount owned by the passed address. */ function balanceOf(address owner) public view returns (uint256) { return _balances[owner]; } /** * @dev Function to check the amount of tokens that an owner allowed to a spender. * @param owner address The address which owns the funds. * @param spender address The address which will spend the funds. * @return A uint256 specifying the amount of tokens still available for the spender. */ function allowance(address owner, address spender) public view returns (uint256) { return _allowed[owner][spender]; } /** * @dev Transfer token for a specified address * @param to The address to transfer to. * @param value The amount to be transferred. */ function transfer(address to, uint256 value) public returns (bool) { _transfer(msg.sender, to, value); return true; } /** * @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender. * Beware that changing an allowance with this method brings the risk that someone may use both the old * and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this * race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * @param spender The address which will spend the funds. * @param value The amount of tokens to be spent. */ function approve(address spender, uint256 value) public returns (bool) { require(spender != address(0)); _allowed[msg.sender][spender] = value; emit Approval(msg.sender, spender, value); return true; } /** * @dev Transfer tokens from one address to another. * Note that while this function emits an Approval event, this is not required as per the specification, * and other compliant implementations may not emit the event. * @param from address The address which you want to send tokens from * @param to address The address which you want to transfer to * @param value uint256 the amount of tokens to be transferred */ function transferFrom(address from, address to, uint256 value) public returns (bool) { _allowed[from][msg.sender] = _allowed[from][msg.sender].sub(value); _transfer(from, to, value); emit Approval(from, msg.sender, _allowed[from][msg.sender]); return true; } /** * @dev Increase the amount of tokens that an owner allowed to a spender. * approve should be called when allowed_[_spender] == 0. To increment * allowed value is better to use this function to avoid 2 calls (and wait until * the first transaction is mined) * From MonolithDAO Token.sol * Emits an Approval event. * @param spender The address which will spend the funds. * @param addedValue The amount of tokens to increase the allowance by. */ function increaseAllowance(address spender, uint256 addedValue) public returns (bool) { require(spender != address(0)); _allowed[msg.sender][spender] = _allowed[msg.sender][spender].add( addedValue ); emit Approval(msg.sender, spender, _allowed[msg.sender][spender]); return true; } /** * @dev Decrease the amount of tokens that an owner allowed to a spender. * approve should be called when allowed_[_spender] == 0. To decrement * allowed value is better to use this function to avoid 2 calls (and wait until * the first transaction is mined) * From MonolithDAO Token.sol * Emits an Approval event. * @param spender The address which will spend the funds. * @param subtractedValue The amount of tokens to decrease the allowance by. */ function decreaseAllowance(address spender, uint256 subtractedValue) public returns (bool) { require(spender != address(0)); _allowed[msg.sender][spender] = _allowed[msg.sender][spender].sub( subtractedValue ); emit Approval(msg.sender, spender, _allowed[msg.sender][spender]); return true; } /** * @dev Transfer token for a specified addresses * @param from The address to transfer from. * @param to The address to transfer to. * @param value The amount to be transferred. */ function _transfer(address from, address to, uint256 value) internal { require(to != address(0)); _balances[from] = _balances[from].sub(value); _balances[to] = _balances[to].add(value); emit Transfer(from, to, value); } /** * @dev Internal function that mints an amount of the token and assigns it to * an account. This encapsulates the modification of balances such that the * proper events are emitted. * @param value The amount that will be created. */ function _mint(uint256 value) internal { require(msg.sender != address(0)); _totalSupply = _totalSupply.add(value); _balances[msg.sender] = _balances[msg.sender].add(value); emit Transfer(address(0), msg.sender, value); } /** * @dev Internal function that burns an amount of the token of a given * account. * @param account The account whose tokens will be burnt. * @param value The amount that will be burnt. */ function _burn(address account, uint256 value) internal { require(account != address(0)); _totalSupply = _totalSupply.sub(value); _balances[account] = _balances[account].sub(value); emit Transfer(account, address(0), value); } /** * @dev Internal function that burns an amount of the token of a given * account, deducting from the sender's allowance for said account. Uses the * internal burn function. * Emits an Approval event (reflecting the reduced allowance). * @param account The account whose tokens will be burnt. * @param value The amount that will be burnt. */ function _burnFrom(address account, uint256 value) internal { _allowed[account][msg.sender] = _allowed[account][msg.sender].sub( value ); _burn(account, value); emit Approval(account, msg.sender, _allowed[account][msg.sender]); } }
/** * @title Standard ERC20 token * * @dev Implementation of the basic standard token. * https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20.md * Originally based on code by FirstBlood: * https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol * * This implementation emits additional Approval events, allowing applications to reconstruct the allowance status for * all accounts just by listening to said events. Note that this isn't required by the specification, and other * compliant implementations may not do it. */
NatSpecMultiLine
approve
function approve(address spender, uint256 value) public returns (bool) { require(spender != address(0)); _allowed[msg.sender][spender] = value; emit Approval(msg.sender, spender, value); return true; }
/** * @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender. * Beware that changing an allowance with this method brings the risk that someone may use both the old * and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this * race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * @param spender The address which will spend the funds. * @param value The amount of tokens to be spent. */
NatSpecMultiLine
v0.5.17+commit.d19bba13
None
bzzr://cfefed105a08f450eba1a193f0c7cb37af76c84c4dc3c10269331305bff11870
{ "func_code_index": [ 2175, 2424 ] }
2,082
Bexpress
Bexpress.sol
0xc002141f62961afa759f7b22aaeb151bf80a3d8d
Solidity
ERC20
contract ERC20 is IERC20 { using SafeMath for uint256; mapping(address => uint256) private _balances; mapping(address => mapping(address => uint256)) private _allowed; uint256 private _totalSupply; /** * @dev Total number of tokens in existence */ function totalSupply() public view returns (uint256) { return _totalSupply; } /** * @dev Gets the balance of the specified address. * @param owner The address to query the balance of. * @return An uint256 representing the amount owned by the passed address. */ function balanceOf(address owner) public view returns (uint256) { return _balances[owner]; } /** * @dev Function to check the amount of tokens that an owner allowed to a spender. * @param owner address The address which owns the funds. * @param spender address The address which will spend the funds. * @return A uint256 specifying the amount of tokens still available for the spender. */ function allowance(address owner, address spender) public view returns (uint256) { return _allowed[owner][spender]; } /** * @dev Transfer token for a specified address * @param to The address to transfer to. * @param value The amount to be transferred. */ function transfer(address to, uint256 value) public returns (bool) { _transfer(msg.sender, to, value); return true; } /** * @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender. * Beware that changing an allowance with this method brings the risk that someone may use both the old * and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this * race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * @param spender The address which will spend the funds. * @param value The amount of tokens to be spent. */ function approve(address spender, uint256 value) public returns (bool) { require(spender != address(0)); _allowed[msg.sender][spender] = value; emit Approval(msg.sender, spender, value); return true; } /** * @dev Transfer tokens from one address to another. * Note that while this function emits an Approval event, this is not required as per the specification, * and other compliant implementations may not emit the event. * @param from address The address which you want to send tokens from * @param to address The address which you want to transfer to * @param value uint256 the amount of tokens to be transferred */ function transferFrom(address from, address to, uint256 value) public returns (bool) { _allowed[from][msg.sender] = _allowed[from][msg.sender].sub(value); _transfer(from, to, value); emit Approval(from, msg.sender, _allowed[from][msg.sender]); return true; } /** * @dev Increase the amount of tokens that an owner allowed to a spender. * approve should be called when allowed_[_spender] == 0. To increment * allowed value is better to use this function to avoid 2 calls (and wait until * the first transaction is mined) * From MonolithDAO Token.sol * Emits an Approval event. * @param spender The address which will spend the funds. * @param addedValue The amount of tokens to increase the allowance by. */ function increaseAllowance(address spender, uint256 addedValue) public returns (bool) { require(spender != address(0)); _allowed[msg.sender][spender] = _allowed[msg.sender][spender].add( addedValue ); emit Approval(msg.sender, spender, _allowed[msg.sender][spender]); return true; } /** * @dev Decrease the amount of tokens that an owner allowed to a spender. * approve should be called when allowed_[_spender] == 0. To decrement * allowed value is better to use this function to avoid 2 calls (and wait until * the first transaction is mined) * From MonolithDAO Token.sol * Emits an Approval event. * @param spender The address which will spend the funds. * @param subtractedValue The amount of tokens to decrease the allowance by. */ function decreaseAllowance(address spender, uint256 subtractedValue) public returns (bool) { require(spender != address(0)); _allowed[msg.sender][spender] = _allowed[msg.sender][spender].sub( subtractedValue ); emit Approval(msg.sender, spender, _allowed[msg.sender][spender]); return true; } /** * @dev Transfer token for a specified addresses * @param from The address to transfer from. * @param to The address to transfer to. * @param value The amount to be transferred. */ function _transfer(address from, address to, uint256 value) internal { require(to != address(0)); _balances[from] = _balances[from].sub(value); _balances[to] = _balances[to].add(value); emit Transfer(from, to, value); } /** * @dev Internal function that mints an amount of the token and assigns it to * an account. This encapsulates the modification of balances such that the * proper events are emitted. * @param value The amount that will be created. */ function _mint(uint256 value) internal { require(msg.sender != address(0)); _totalSupply = _totalSupply.add(value); _balances[msg.sender] = _balances[msg.sender].add(value); emit Transfer(address(0), msg.sender, value); } /** * @dev Internal function that burns an amount of the token of a given * account. * @param account The account whose tokens will be burnt. * @param value The amount that will be burnt. */ function _burn(address account, uint256 value) internal { require(account != address(0)); _totalSupply = _totalSupply.sub(value); _balances[account] = _balances[account].sub(value); emit Transfer(account, address(0), value); } /** * @dev Internal function that burns an amount of the token of a given * account, deducting from the sender's allowance for said account. Uses the * internal burn function. * Emits an Approval event (reflecting the reduced allowance). * @param account The account whose tokens will be burnt. * @param value The amount that will be burnt. */ function _burnFrom(address account, uint256 value) internal { _allowed[account][msg.sender] = _allowed[account][msg.sender].sub( value ); _burn(account, value); emit Approval(account, msg.sender, _allowed[account][msg.sender]); } }
/** * @title Standard ERC20 token * * @dev Implementation of the basic standard token. * https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20.md * Originally based on code by FirstBlood: * https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol * * This implementation emits additional Approval events, allowing applications to reconstruct the allowance status for * all accounts just by listening to said events. Note that this isn't required by the specification, and other * compliant implementations may not do it. */
NatSpecMultiLine
transferFrom
function transferFrom(address from, address to, uint256 value) public returns (bool) { _allowed[from][msg.sender] = _allowed[from][msg.sender].sub(value); _transfer(from, to, value); emit Approval(from, msg.sender, _allowed[from][msg.sender]); return true; }
/** * @dev Transfer tokens from one address to another. * Note that while this function emits an Approval event, this is not required as per the specification, * and other compliant implementations may not emit the event. * @param from address The address which you want to send tokens from * @param to address The address which you want to transfer to * @param value uint256 the amount of tokens to be transferred */
NatSpecMultiLine
v0.5.17+commit.d19bba13
None
bzzr://cfefed105a08f450eba1a193f0c7cb37af76c84c4dc3c10269331305bff11870
{ "func_code_index": [ 2892, 3219 ] }
2,083
Bexpress
Bexpress.sol
0xc002141f62961afa759f7b22aaeb151bf80a3d8d
Solidity
ERC20
contract ERC20 is IERC20 { using SafeMath for uint256; mapping(address => uint256) private _balances; mapping(address => mapping(address => uint256)) private _allowed; uint256 private _totalSupply; /** * @dev Total number of tokens in existence */ function totalSupply() public view returns (uint256) { return _totalSupply; } /** * @dev Gets the balance of the specified address. * @param owner The address to query the balance of. * @return An uint256 representing the amount owned by the passed address. */ function balanceOf(address owner) public view returns (uint256) { return _balances[owner]; } /** * @dev Function to check the amount of tokens that an owner allowed to a spender. * @param owner address The address which owns the funds. * @param spender address The address which will spend the funds. * @return A uint256 specifying the amount of tokens still available for the spender. */ function allowance(address owner, address spender) public view returns (uint256) { return _allowed[owner][spender]; } /** * @dev Transfer token for a specified address * @param to The address to transfer to. * @param value The amount to be transferred. */ function transfer(address to, uint256 value) public returns (bool) { _transfer(msg.sender, to, value); return true; } /** * @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender. * Beware that changing an allowance with this method brings the risk that someone may use both the old * and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this * race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * @param spender The address which will spend the funds. * @param value The amount of tokens to be spent. */ function approve(address spender, uint256 value) public returns (bool) { require(spender != address(0)); _allowed[msg.sender][spender] = value; emit Approval(msg.sender, spender, value); return true; } /** * @dev Transfer tokens from one address to another. * Note that while this function emits an Approval event, this is not required as per the specification, * and other compliant implementations may not emit the event. * @param from address The address which you want to send tokens from * @param to address The address which you want to transfer to * @param value uint256 the amount of tokens to be transferred */ function transferFrom(address from, address to, uint256 value) public returns (bool) { _allowed[from][msg.sender] = _allowed[from][msg.sender].sub(value); _transfer(from, to, value); emit Approval(from, msg.sender, _allowed[from][msg.sender]); return true; } /** * @dev Increase the amount of tokens that an owner allowed to a spender. * approve should be called when allowed_[_spender] == 0. To increment * allowed value is better to use this function to avoid 2 calls (and wait until * the first transaction is mined) * From MonolithDAO Token.sol * Emits an Approval event. * @param spender The address which will spend the funds. * @param addedValue The amount of tokens to increase the allowance by. */ function increaseAllowance(address spender, uint256 addedValue) public returns (bool) { require(spender != address(0)); _allowed[msg.sender][spender] = _allowed[msg.sender][spender].add( addedValue ); emit Approval(msg.sender, spender, _allowed[msg.sender][spender]); return true; } /** * @dev Decrease the amount of tokens that an owner allowed to a spender. * approve should be called when allowed_[_spender] == 0. To decrement * allowed value is better to use this function to avoid 2 calls (and wait until * the first transaction is mined) * From MonolithDAO Token.sol * Emits an Approval event. * @param spender The address which will spend the funds. * @param subtractedValue The amount of tokens to decrease the allowance by. */ function decreaseAllowance(address spender, uint256 subtractedValue) public returns (bool) { require(spender != address(0)); _allowed[msg.sender][spender] = _allowed[msg.sender][spender].sub( subtractedValue ); emit Approval(msg.sender, spender, _allowed[msg.sender][spender]); return true; } /** * @dev Transfer token for a specified addresses * @param from The address to transfer from. * @param to The address to transfer to. * @param value The amount to be transferred. */ function _transfer(address from, address to, uint256 value) internal { require(to != address(0)); _balances[from] = _balances[from].sub(value); _balances[to] = _balances[to].add(value); emit Transfer(from, to, value); } /** * @dev Internal function that mints an amount of the token and assigns it to * an account. This encapsulates the modification of balances such that the * proper events are emitted. * @param value The amount that will be created. */ function _mint(uint256 value) internal { require(msg.sender != address(0)); _totalSupply = _totalSupply.add(value); _balances[msg.sender] = _balances[msg.sender].add(value); emit Transfer(address(0), msg.sender, value); } /** * @dev Internal function that burns an amount of the token of a given * account. * @param account The account whose tokens will be burnt. * @param value The amount that will be burnt. */ function _burn(address account, uint256 value) internal { require(account != address(0)); _totalSupply = _totalSupply.sub(value); _balances[account] = _balances[account].sub(value); emit Transfer(account, address(0), value); } /** * @dev Internal function that burns an amount of the token of a given * account, deducting from the sender's allowance for said account. Uses the * internal burn function. * Emits an Approval event (reflecting the reduced allowance). * @param account The account whose tokens will be burnt. * @param value The amount that will be burnt. */ function _burnFrom(address account, uint256 value) internal { _allowed[account][msg.sender] = _allowed[account][msg.sender].sub( value ); _burn(account, value); emit Approval(account, msg.sender, _allowed[account][msg.sender]); } }
/** * @title Standard ERC20 token * * @dev Implementation of the basic standard token. * https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20.md * Originally based on code by FirstBlood: * https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol * * This implementation emits additional Approval events, allowing applications to reconstruct the allowance status for * all accounts just by listening to said events. Note that this isn't required by the specification, and other * compliant implementations may not do it. */
NatSpecMultiLine
increaseAllowance
function increaseAllowance(address spender, uint256 addedValue) public returns (bool) { require(spender != address(0)); _allowed[msg.sender][spender] = _allowed[msg.sender][spender].add( addedValue ); emit Approval(msg.sender, spender, _allowed[msg.sender][spender]); return true; }
/** * @dev Increase the amount of tokens that an owner allowed to a spender. * approve should be called when allowed_[_spender] == 0. To increment * allowed value is better to use this function to avoid 2 calls (and wait until * the first transaction is mined) * From MonolithDAO Token.sol * Emits an Approval event. * @param spender The address which will spend the funds. * @param addedValue The amount of tokens to increase the allowance by. */
NatSpecMultiLine
v0.5.17+commit.d19bba13
None
bzzr://cfefed105a08f450eba1a193f0c7cb37af76c84c4dc3c10269331305bff11870
{ "func_code_index": [ 3729, 4104 ] }
2,084
Bexpress
Bexpress.sol
0xc002141f62961afa759f7b22aaeb151bf80a3d8d
Solidity
ERC20
contract ERC20 is IERC20 { using SafeMath for uint256; mapping(address => uint256) private _balances; mapping(address => mapping(address => uint256)) private _allowed; uint256 private _totalSupply; /** * @dev Total number of tokens in existence */ function totalSupply() public view returns (uint256) { return _totalSupply; } /** * @dev Gets the balance of the specified address. * @param owner The address to query the balance of. * @return An uint256 representing the amount owned by the passed address. */ function balanceOf(address owner) public view returns (uint256) { return _balances[owner]; } /** * @dev Function to check the amount of tokens that an owner allowed to a spender. * @param owner address The address which owns the funds. * @param spender address The address which will spend the funds. * @return A uint256 specifying the amount of tokens still available for the spender. */ function allowance(address owner, address spender) public view returns (uint256) { return _allowed[owner][spender]; } /** * @dev Transfer token for a specified address * @param to The address to transfer to. * @param value The amount to be transferred. */ function transfer(address to, uint256 value) public returns (bool) { _transfer(msg.sender, to, value); return true; } /** * @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender. * Beware that changing an allowance with this method brings the risk that someone may use both the old * and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this * race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * @param spender The address which will spend the funds. * @param value The amount of tokens to be spent. */ function approve(address spender, uint256 value) public returns (bool) { require(spender != address(0)); _allowed[msg.sender][spender] = value; emit Approval(msg.sender, spender, value); return true; } /** * @dev Transfer tokens from one address to another. * Note that while this function emits an Approval event, this is not required as per the specification, * and other compliant implementations may not emit the event. * @param from address The address which you want to send tokens from * @param to address The address which you want to transfer to * @param value uint256 the amount of tokens to be transferred */ function transferFrom(address from, address to, uint256 value) public returns (bool) { _allowed[from][msg.sender] = _allowed[from][msg.sender].sub(value); _transfer(from, to, value); emit Approval(from, msg.sender, _allowed[from][msg.sender]); return true; } /** * @dev Increase the amount of tokens that an owner allowed to a spender. * approve should be called when allowed_[_spender] == 0. To increment * allowed value is better to use this function to avoid 2 calls (and wait until * the first transaction is mined) * From MonolithDAO Token.sol * Emits an Approval event. * @param spender The address which will spend the funds. * @param addedValue The amount of tokens to increase the allowance by. */ function increaseAllowance(address spender, uint256 addedValue) public returns (bool) { require(spender != address(0)); _allowed[msg.sender][spender] = _allowed[msg.sender][spender].add( addedValue ); emit Approval(msg.sender, spender, _allowed[msg.sender][spender]); return true; } /** * @dev Decrease the amount of tokens that an owner allowed to a spender. * approve should be called when allowed_[_spender] == 0. To decrement * allowed value is better to use this function to avoid 2 calls (and wait until * the first transaction is mined) * From MonolithDAO Token.sol * Emits an Approval event. * @param spender The address which will spend the funds. * @param subtractedValue The amount of tokens to decrease the allowance by. */ function decreaseAllowance(address spender, uint256 subtractedValue) public returns (bool) { require(spender != address(0)); _allowed[msg.sender][spender] = _allowed[msg.sender][spender].sub( subtractedValue ); emit Approval(msg.sender, spender, _allowed[msg.sender][spender]); return true; } /** * @dev Transfer token for a specified addresses * @param from The address to transfer from. * @param to The address to transfer to. * @param value The amount to be transferred. */ function _transfer(address from, address to, uint256 value) internal { require(to != address(0)); _balances[from] = _balances[from].sub(value); _balances[to] = _balances[to].add(value); emit Transfer(from, to, value); } /** * @dev Internal function that mints an amount of the token and assigns it to * an account. This encapsulates the modification of balances such that the * proper events are emitted. * @param value The amount that will be created. */ function _mint(uint256 value) internal { require(msg.sender != address(0)); _totalSupply = _totalSupply.add(value); _balances[msg.sender] = _balances[msg.sender].add(value); emit Transfer(address(0), msg.sender, value); } /** * @dev Internal function that burns an amount of the token of a given * account. * @param account The account whose tokens will be burnt. * @param value The amount that will be burnt. */ function _burn(address account, uint256 value) internal { require(account != address(0)); _totalSupply = _totalSupply.sub(value); _balances[account] = _balances[account].sub(value); emit Transfer(account, address(0), value); } /** * @dev Internal function that burns an amount of the token of a given * account, deducting from the sender's allowance for said account. Uses the * internal burn function. * Emits an Approval event (reflecting the reduced allowance). * @param account The account whose tokens will be burnt. * @param value The amount that will be burnt. */ function _burnFrom(address account, uint256 value) internal { _allowed[account][msg.sender] = _allowed[account][msg.sender].sub( value ); _burn(account, value); emit Approval(account, msg.sender, _allowed[account][msg.sender]); } }
/** * @title Standard ERC20 token * * @dev Implementation of the basic standard token. * https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20.md * Originally based on code by FirstBlood: * https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol * * This implementation emits additional Approval events, allowing applications to reconstruct the allowance status for * all accounts just by listening to said events. Note that this isn't required by the specification, and other * compliant implementations may not do it. */
NatSpecMultiLine
decreaseAllowance
function decreaseAllowance(address spender, uint256 subtractedValue) public returns (bool) { require(spender != address(0)); _allowed[msg.sender][spender] = _allowed[msg.sender][spender].sub( subtractedValue ); emit Approval(msg.sender, spender, _allowed[msg.sender][spender]); return true; }
/** * @dev Decrease the amount of tokens that an owner allowed to a spender. * approve should be called when allowed_[_spender] == 0. To decrement * allowed value is better to use this function to avoid 2 calls (and wait until * the first transaction is mined) * From MonolithDAO Token.sol * Emits an Approval event. * @param spender The address which will spend the funds. * @param subtractedValue The amount of tokens to decrease the allowance by. */
NatSpecMultiLine
v0.5.17+commit.d19bba13
None
bzzr://cfefed105a08f450eba1a193f0c7cb37af76c84c4dc3c10269331305bff11870
{ "func_code_index": [ 4619, 5004 ] }
2,085
Bexpress
Bexpress.sol
0xc002141f62961afa759f7b22aaeb151bf80a3d8d
Solidity
ERC20
contract ERC20 is IERC20 { using SafeMath for uint256; mapping(address => uint256) private _balances; mapping(address => mapping(address => uint256)) private _allowed; uint256 private _totalSupply; /** * @dev Total number of tokens in existence */ function totalSupply() public view returns (uint256) { return _totalSupply; } /** * @dev Gets the balance of the specified address. * @param owner The address to query the balance of. * @return An uint256 representing the amount owned by the passed address. */ function balanceOf(address owner) public view returns (uint256) { return _balances[owner]; } /** * @dev Function to check the amount of tokens that an owner allowed to a spender. * @param owner address The address which owns the funds. * @param spender address The address which will spend the funds. * @return A uint256 specifying the amount of tokens still available for the spender. */ function allowance(address owner, address spender) public view returns (uint256) { return _allowed[owner][spender]; } /** * @dev Transfer token for a specified address * @param to The address to transfer to. * @param value The amount to be transferred. */ function transfer(address to, uint256 value) public returns (bool) { _transfer(msg.sender, to, value); return true; } /** * @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender. * Beware that changing an allowance with this method brings the risk that someone may use both the old * and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this * race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * @param spender The address which will spend the funds. * @param value The amount of tokens to be spent. */ function approve(address spender, uint256 value) public returns (bool) { require(spender != address(0)); _allowed[msg.sender][spender] = value; emit Approval(msg.sender, spender, value); return true; } /** * @dev Transfer tokens from one address to another. * Note that while this function emits an Approval event, this is not required as per the specification, * and other compliant implementations may not emit the event. * @param from address The address which you want to send tokens from * @param to address The address which you want to transfer to * @param value uint256 the amount of tokens to be transferred */ function transferFrom(address from, address to, uint256 value) public returns (bool) { _allowed[from][msg.sender] = _allowed[from][msg.sender].sub(value); _transfer(from, to, value); emit Approval(from, msg.sender, _allowed[from][msg.sender]); return true; } /** * @dev Increase the amount of tokens that an owner allowed to a spender. * approve should be called when allowed_[_spender] == 0. To increment * allowed value is better to use this function to avoid 2 calls (and wait until * the first transaction is mined) * From MonolithDAO Token.sol * Emits an Approval event. * @param spender The address which will spend the funds. * @param addedValue The amount of tokens to increase the allowance by. */ function increaseAllowance(address spender, uint256 addedValue) public returns (bool) { require(spender != address(0)); _allowed[msg.sender][spender] = _allowed[msg.sender][spender].add( addedValue ); emit Approval(msg.sender, spender, _allowed[msg.sender][spender]); return true; } /** * @dev Decrease the amount of tokens that an owner allowed to a spender. * approve should be called when allowed_[_spender] == 0. To decrement * allowed value is better to use this function to avoid 2 calls (and wait until * the first transaction is mined) * From MonolithDAO Token.sol * Emits an Approval event. * @param spender The address which will spend the funds. * @param subtractedValue The amount of tokens to decrease the allowance by. */ function decreaseAllowance(address spender, uint256 subtractedValue) public returns (bool) { require(spender != address(0)); _allowed[msg.sender][spender] = _allowed[msg.sender][spender].sub( subtractedValue ); emit Approval(msg.sender, spender, _allowed[msg.sender][spender]); return true; } /** * @dev Transfer token for a specified addresses * @param from The address to transfer from. * @param to The address to transfer to. * @param value The amount to be transferred. */ function _transfer(address from, address to, uint256 value) internal { require(to != address(0)); _balances[from] = _balances[from].sub(value); _balances[to] = _balances[to].add(value); emit Transfer(from, to, value); } /** * @dev Internal function that mints an amount of the token and assigns it to * an account. This encapsulates the modification of balances such that the * proper events are emitted. * @param value The amount that will be created. */ function _mint(uint256 value) internal { require(msg.sender != address(0)); _totalSupply = _totalSupply.add(value); _balances[msg.sender] = _balances[msg.sender].add(value); emit Transfer(address(0), msg.sender, value); } /** * @dev Internal function that burns an amount of the token of a given * account. * @param account The account whose tokens will be burnt. * @param value The amount that will be burnt. */ function _burn(address account, uint256 value) internal { require(account != address(0)); _totalSupply = _totalSupply.sub(value); _balances[account] = _balances[account].sub(value); emit Transfer(account, address(0), value); } /** * @dev Internal function that burns an amount of the token of a given * account, deducting from the sender's allowance for said account. Uses the * internal burn function. * Emits an Approval event (reflecting the reduced allowance). * @param account The account whose tokens will be burnt. * @param value The amount that will be burnt. */ function _burnFrom(address account, uint256 value) internal { _allowed[account][msg.sender] = _allowed[account][msg.sender].sub( value ); _burn(account, value); emit Approval(account, msg.sender, _allowed[account][msg.sender]); } }
/** * @title Standard ERC20 token * * @dev Implementation of the basic standard token. * https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20.md * Originally based on code by FirstBlood: * https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol * * This implementation emits additional Approval events, allowing applications to reconstruct the allowance status for * all accounts just by listening to said events. Note that this isn't required by the specification, and other * compliant implementations may not do it. */
NatSpecMultiLine
_transfer
function _transfer(address from, address to, uint256 value) internal { require(to != address(0)); _balances[from] = _balances[from].sub(value); _balances[to] = _balances[to].add(value); emit Transfer(from, to, value); }
/** * @dev Transfer token for a specified addresses * @param from The address to transfer from. * @param to The address to transfer to. * @param value The amount to be transferred. */
NatSpecMultiLine
v0.5.17+commit.d19bba13
None
bzzr://cfefed105a08f450eba1a193f0c7cb37af76c84c4dc3c10269331305bff11870
{ "func_code_index": [ 5226, 5493 ] }
2,086
Bexpress
Bexpress.sol
0xc002141f62961afa759f7b22aaeb151bf80a3d8d
Solidity
ERC20
contract ERC20 is IERC20 { using SafeMath for uint256; mapping(address => uint256) private _balances; mapping(address => mapping(address => uint256)) private _allowed; uint256 private _totalSupply; /** * @dev Total number of tokens in existence */ function totalSupply() public view returns (uint256) { return _totalSupply; } /** * @dev Gets the balance of the specified address. * @param owner The address to query the balance of. * @return An uint256 representing the amount owned by the passed address. */ function balanceOf(address owner) public view returns (uint256) { return _balances[owner]; } /** * @dev Function to check the amount of tokens that an owner allowed to a spender. * @param owner address The address which owns the funds. * @param spender address The address which will spend the funds. * @return A uint256 specifying the amount of tokens still available for the spender. */ function allowance(address owner, address spender) public view returns (uint256) { return _allowed[owner][spender]; } /** * @dev Transfer token for a specified address * @param to The address to transfer to. * @param value The amount to be transferred. */ function transfer(address to, uint256 value) public returns (bool) { _transfer(msg.sender, to, value); return true; } /** * @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender. * Beware that changing an allowance with this method brings the risk that someone may use both the old * and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this * race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * @param spender The address which will spend the funds. * @param value The amount of tokens to be spent. */ function approve(address spender, uint256 value) public returns (bool) { require(spender != address(0)); _allowed[msg.sender][spender] = value; emit Approval(msg.sender, spender, value); return true; } /** * @dev Transfer tokens from one address to another. * Note that while this function emits an Approval event, this is not required as per the specification, * and other compliant implementations may not emit the event. * @param from address The address which you want to send tokens from * @param to address The address which you want to transfer to * @param value uint256 the amount of tokens to be transferred */ function transferFrom(address from, address to, uint256 value) public returns (bool) { _allowed[from][msg.sender] = _allowed[from][msg.sender].sub(value); _transfer(from, to, value); emit Approval(from, msg.sender, _allowed[from][msg.sender]); return true; } /** * @dev Increase the amount of tokens that an owner allowed to a spender. * approve should be called when allowed_[_spender] == 0. To increment * allowed value is better to use this function to avoid 2 calls (and wait until * the first transaction is mined) * From MonolithDAO Token.sol * Emits an Approval event. * @param spender The address which will spend the funds. * @param addedValue The amount of tokens to increase the allowance by. */ function increaseAllowance(address spender, uint256 addedValue) public returns (bool) { require(spender != address(0)); _allowed[msg.sender][spender] = _allowed[msg.sender][spender].add( addedValue ); emit Approval(msg.sender, spender, _allowed[msg.sender][spender]); return true; } /** * @dev Decrease the amount of tokens that an owner allowed to a spender. * approve should be called when allowed_[_spender] == 0. To decrement * allowed value is better to use this function to avoid 2 calls (and wait until * the first transaction is mined) * From MonolithDAO Token.sol * Emits an Approval event. * @param spender The address which will spend the funds. * @param subtractedValue The amount of tokens to decrease the allowance by. */ function decreaseAllowance(address spender, uint256 subtractedValue) public returns (bool) { require(spender != address(0)); _allowed[msg.sender][spender] = _allowed[msg.sender][spender].sub( subtractedValue ); emit Approval(msg.sender, spender, _allowed[msg.sender][spender]); return true; } /** * @dev Transfer token for a specified addresses * @param from The address to transfer from. * @param to The address to transfer to. * @param value The amount to be transferred. */ function _transfer(address from, address to, uint256 value) internal { require(to != address(0)); _balances[from] = _balances[from].sub(value); _balances[to] = _balances[to].add(value); emit Transfer(from, to, value); } /** * @dev Internal function that mints an amount of the token and assigns it to * an account. This encapsulates the modification of balances such that the * proper events are emitted. * @param value The amount that will be created. */ function _mint(uint256 value) internal { require(msg.sender != address(0)); _totalSupply = _totalSupply.add(value); _balances[msg.sender] = _balances[msg.sender].add(value); emit Transfer(address(0), msg.sender, value); } /** * @dev Internal function that burns an amount of the token of a given * account. * @param account The account whose tokens will be burnt. * @param value The amount that will be burnt. */ function _burn(address account, uint256 value) internal { require(account != address(0)); _totalSupply = _totalSupply.sub(value); _balances[account] = _balances[account].sub(value); emit Transfer(account, address(0), value); } /** * @dev Internal function that burns an amount of the token of a given * account, deducting from the sender's allowance for said account. Uses the * internal burn function. * Emits an Approval event (reflecting the reduced allowance). * @param account The account whose tokens will be burnt. * @param value The amount that will be burnt. */ function _burnFrom(address account, uint256 value) internal { _allowed[account][msg.sender] = _allowed[account][msg.sender].sub( value ); _burn(account, value); emit Approval(account, msg.sender, _allowed[account][msg.sender]); } }
/** * @title Standard ERC20 token * * @dev Implementation of the basic standard token. * https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20.md * Originally based on code by FirstBlood: * https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol * * This implementation emits additional Approval events, allowing applications to reconstruct the allowance status for * all accounts just by listening to said events. Note that this isn't required by the specification, and other * compliant implementations may not do it. */
NatSpecMultiLine
_mint
function _mint(uint256 value) internal { require(msg.sender != address(0)); _totalSupply = _totalSupply.add(value); _balances[msg.sender] = _balances[msg.sender].add(value); emit Transfer(address(0), msg.sender, value); }
/** * @dev Internal function that mints an amount of the token and assigns it to * an account. This encapsulates the modification of balances such that the * proper events are emitted. * @param value The amount that will be created. */
NatSpecMultiLine
v0.5.17+commit.d19bba13
None
bzzr://cfefed105a08f450eba1a193f0c7cb37af76c84c4dc3c10269331305bff11870
{ "func_code_index": [ 5767, 6036 ] }
2,087
Bexpress
Bexpress.sol
0xc002141f62961afa759f7b22aaeb151bf80a3d8d
Solidity
ERC20
contract ERC20 is IERC20 { using SafeMath for uint256; mapping(address => uint256) private _balances; mapping(address => mapping(address => uint256)) private _allowed; uint256 private _totalSupply; /** * @dev Total number of tokens in existence */ function totalSupply() public view returns (uint256) { return _totalSupply; } /** * @dev Gets the balance of the specified address. * @param owner The address to query the balance of. * @return An uint256 representing the amount owned by the passed address. */ function balanceOf(address owner) public view returns (uint256) { return _balances[owner]; } /** * @dev Function to check the amount of tokens that an owner allowed to a spender. * @param owner address The address which owns the funds. * @param spender address The address which will spend the funds. * @return A uint256 specifying the amount of tokens still available for the spender. */ function allowance(address owner, address spender) public view returns (uint256) { return _allowed[owner][spender]; } /** * @dev Transfer token for a specified address * @param to The address to transfer to. * @param value The amount to be transferred. */ function transfer(address to, uint256 value) public returns (bool) { _transfer(msg.sender, to, value); return true; } /** * @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender. * Beware that changing an allowance with this method brings the risk that someone may use both the old * and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this * race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * @param spender The address which will spend the funds. * @param value The amount of tokens to be spent. */ function approve(address spender, uint256 value) public returns (bool) { require(spender != address(0)); _allowed[msg.sender][spender] = value; emit Approval(msg.sender, spender, value); return true; } /** * @dev Transfer tokens from one address to another. * Note that while this function emits an Approval event, this is not required as per the specification, * and other compliant implementations may not emit the event. * @param from address The address which you want to send tokens from * @param to address The address which you want to transfer to * @param value uint256 the amount of tokens to be transferred */ function transferFrom(address from, address to, uint256 value) public returns (bool) { _allowed[from][msg.sender] = _allowed[from][msg.sender].sub(value); _transfer(from, to, value); emit Approval(from, msg.sender, _allowed[from][msg.sender]); return true; } /** * @dev Increase the amount of tokens that an owner allowed to a spender. * approve should be called when allowed_[_spender] == 0. To increment * allowed value is better to use this function to avoid 2 calls (and wait until * the first transaction is mined) * From MonolithDAO Token.sol * Emits an Approval event. * @param spender The address which will spend the funds. * @param addedValue The amount of tokens to increase the allowance by. */ function increaseAllowance(address spender, uint256 addedValue) public returns (bool) { require(spender != address(0)); _allowed[msg.sender][spender] = _allowed[msg.sender][spender].add( addedValue ); emit Approval(msg.sender, spender, _allowed[msg.sender][spender]); return true; } /** * @dev Decrease the amount of tokens that an owner allowed to a spender. * approve should be called when allowed_[_spender] == 0. To decrement * allowed value is better to use this function to avoid 2 calls (and wait until * the first transaction is mined) * From MonolithDAO Token.sol * Emits an Approval event. * @param spender The address which will spend the funds. * @param subtractedValue The amount of tokens to decrease the allowance by. */ function decreaseAllowance(address spender, uint256 subtractedValue) public returns (bool) { require(spender != address(0)); _allowed[msg.sender][spender] = _allowed[msg.sender][spender].sub( subtractedValue ); emit Approval(msg.sender, spender, _allowed[msg.sender][spender]); return true; } /** * @dev Transfer token for a specified addresses * @param from The address to transfer from. * @param to The address to transfer to. * @param value The amount to be transferred. */ function _transfer(address from, address to, uint256 value) internal { require(to != address(0)); _balances[from] = _balances[from].sub(value); _balances[to] = _balances[to].add(value); emit Transfer(from, to, value); } /** * @dev Internal function that mints an amount of the token and assigns it to * an account. This encapsulates the modification of balances such that the * proper events are emitted. * @param value The amount that will be created. */ function _mint(uint256 value) internal { require(msg.sender != address(0)); _totalSupply = _totalSupply.add(value); _balances[msg.sender] = _balances[msg.sender].add(value); emit Transfer(address(0), msg.sender, value); } /** * @dev Internal function that burns an amount of the token of a given * account. * @param account The account whose tokens will be burnt. * @param value The amount that will be burnt. */ function _burn(address account, uint256 value) internal { require(account != address(0)); _totalSupply = _totalSupply.sub(value); _balances[account] = _balances[account].sub(value); emit Transfer(account, address(0), value); } /** * @dev Internal function that burns an amount of the token of a given * account, deducting from the sender's allowance for said account. Uses the * internal burn function. * Emits an Approval event (reflecting the reduced allowance). * @param account The account whose tokens will be burnt. * @param value The amount that will be burnt. */ function _burnFrom(address account, uint256 value) internal { _allowed[account][msg.sender] = _allowed[account][msg.sender].sub( value ); _burn(account, value); emit Approval(account, msg.sender, _allowed[account][msg.sender]); } }
/** * @title Standard ERC20 token * * @dev Implementation of the basic standard token. * https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20.md * Originally based on code by FirstBlood: * https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol * * This implementation emits additional Approval events, allowing applications to reconstruct the allowance status for * all accounts just by listening to said events. Note that this isn't required by the specification, and other * compliant implementations may not do it. */
NatSpecMultiLine
_burn
function _burn(address account, uint256 value) internal { require(account != address(0)); _totalSupply = _totalSupply.sub(value); _balances[account] = _balances[account].sub(value); emit Transfer(account, address(0), value); }
/** * @dev Internal function that burns an amount of the token of a given * account. * @param account The account whose tokens will be burnt. * @param value The amount that will be burnt. */
NatSpecMultiLine
v0.5.17+commit.d19bba13
None
bzzr://cfefed105a08f450eba1a193f0c7cb37af76c84c4dc3c10269331305bff11870
{ "func_code_index": [ 6265, 6539 ] }
2,088
Bexpress
Bexpress.sol
0xc002141f62961afa759f7b22aaeb151bf80a3d8d
Solidity
ERC20
contract ERC20 is IERC20 { using SafeMath for uint256; mapping(address => uint256) private _balances; mapping(address => mapping(address => uint256)) private _allowed; uint256 private _totalSupply; /** * @dev Total number of tokens in existence */ function totalSupply() public view returns (uint256) { return _totalSupply; } /** * @dev Gets the balance of the specified address. * @param owner The address to query the balance of. * @return An uint256 representing the amount owned by the passed address. */ function balanceOf(address owner) public view returns (uint256) { return _balances[owner]; } /** * @dev Function to check the amount of tokens that an owner allowed to a spender. * @param owner address The address which owns the funds. * @param spender address The address which will spend the funds. * @return A uint256 specifying the amount of tokens still available for the spender. */ function allowance(address owner, address spender) public view returns (uint256) { return _allowed[owner][spender]; } /** * @dev Transfer token for a specified address * @param to The address to transfer to. * @param value The amount to be transferred. */ function transfer(address to, uint256 value) public returns (bool) { _transfer(msg.sender, to, value); return true; } /** * @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender. * Beware that changing an allowance with this method brings the risk that someone may use both the old * and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this * race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * @param spender The address which will spend the funds. * @param value The amount of tokens to be spent. */ function approve(address spender, uint256 value) public returns (bool) { require(spender != address(0)); _allowed[msg.sender][spender] = value; emit Approval(msg.sender, spender, value); return true; } /** * @dev Transfer tokens from one address to another. * Note that while this function emits an Approval event, this is not required as per the specification, * and other compliant implementations may not emit the event. * @param from address The address which you want to send tokens from * @param to address The address which you want to transfer to * @param value uint256 the amount of tokens to be transferred */ function transferFrom(address from, address to, uint256 value) public returns (bool) { _allowed[from][msg.sender] = _allowed[from][msg.sender].sub(value); _transfer(from, to, value); emit Approval(from, msg.sender, _allowed[from][msg.sender]); return true; } /** * @dev Increase the amount of tokens that an owner allowed to a spender. * approve should be called when allowed_[_spender] == 0. To increment * allowed value is better to use this function to avoid 2 calls (and wait until * the first transaction is mined) * From MonolithDAO Token.sol * Emits an Approval event. * @param spender The address which will spend the funds. * @param addedValue The amount of tokens to increase the allowance by. */ function increaseAllowance(address spender, uint256 addedValue) public returns (bool) { require(spender != address(0)); _allowed[msg.sender][spender] = _allowed[msg.sender][spender].add( addedValue ); emit Approval(msg.sender, spender, _allowed[msg.sender][spender]); return true; } /** * @dev Decrease the amount of tokens that an owner allowed to a spender. * approve should be called when allowed_[_spender] == 0. To decrement * allowed value is better to use this function to avoid 2 calls (and wait until * the first transaction is mined) * From MonolithDAO Token.sol * Emits an Approval event. * @param spender The address which will spend the funds. * @param subtractedValue The amount of tokens to decrease the allowance by. */ function decreaseAllowance(address spender, uint256 subtractedValue) public returns (bool) { require(spender != address(0)); _allowed[msg.sender][spender] = _allowed[msg.sender][spender].sub( subtractedValue ); emit Approval(msg.sender, spender, _allowed[msg.sender][spender]); return true; } /** * @dev Transfer token for a specified addresses * @param from The address to transfer from. * @param to The address to transfer to. * @param value The amount to be transferred. */ function _transfer(address from, address to, uint256 value) internal { require(to != address(0)); _balances[from] = _balances[from].sub(value); _balances[to] = _balances[to].add(value); emit Transfer(from, to, value); } /** * @dev Internal function that mints an amount of the token and assigns it to * an account. This encapsulates the modification of balances such that the * proper events are emitted. * @param value The amount that will be created. */ function _mint(uint256 value) internal { require(msg.sender != address(0)); _totalSupply = _totalSupply.add(value); _balances[msg.sender] = _balances[msg.sender].add(value); emit Transfer(address(0), msg.sender, value); } /** * @dev Internal function that burns an amount of the token of a given * account. * @param account The account whose tokens will be burnt. * @param value The amount that will be burnt. */ function _burn(address account, uint256 value) internal { require(account != address(0)); _totalSupply = _totalSupply.sub(value); _balances[account] = _balances[account].sub(value); emit Transfer(account, address(0), value); } /** * @dev Internal function that burns an amount of the token of a given * account, deducting from the sender's allowance for said account. Uses the * internal burn function. * Emits an Approval event (reflecting the reduced allowance). * @param account The account whose tokens will be burnt. * @param value The amount that will be burnt. */ function _burnFrom(address account, uint256 value) internal { _allowed[account][msg.sender] = _allowed[account][msg.sender].sub( value ); _burn(account, value); emit Approval(account, msg.sender, _allowed[account][msg.sender]); } }
/** * @title Standard ERC20 token * * @dev Implementation of the basic standard token. * https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20.md * Originally based on code by FirstBlood: * https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol * * This implementation emits additional Approval events, allowing applications to reconstruct the allowance status for * all accounts just by listening to said events. Note that this isn't required by the specification, and other * compliant implementations may not do it. */
NatSpecMultiLine
_burnFrom
function _burnFrom(address account, uint256 value) internal { _allowed[account][msg.sender] = _allowed[account][msg.sender].sub( value ); _burn(account, value); emit Approval(account, msg.sender, _allowed[account][msg.sender]); }
/** * @dev Internal function that burns an amount of the token of a given * account, deducting from the sender's allowance for said account. Uses the * internal burn function. * Emits an Approval event (reflecting the reduced allowance). * @param account The account whose tokens will be burnt. * @param value The amount that will be burnt. */
NatSpecMultiLine
v0.5.17+commit.d19bba13
None
bzzr://cfefed105a08f450eba1a193f0c7cb37af76c84c4dc3c10269331305bff11870
{ "func_code_index": [ 6933, 7221 ] }
2,089
Bexpress
Bexpress.sol
0xc002141f62961afa759f7b22aaeb151bf80a3d8d
Solidity
Roles
library Roles { struct Role { mapping(address => bool) bearer; } /** * @dev give an account access to this role */ function add(Role storage role, address account) internal { require(account != address(0)); require(!has(role, account)); role.bearer[account] = true; } /** * @dev remove an account's access to this role */ function remove(Role storage role, address account) internal { require(account != address(0)); require(has(role, account)); role.bearer[account] = false; } /** * @dev check if an account has this role * @return bool */ function has(Role storage role, address account) internal view returns (bool) { require(account != address(0)); return role.bearer[account]; } }
/** * @title Roles * @dev Library for managing addresses assigned to a Role. */
NatSpecMultiLine
add
function add(Role storage role, address account) internal { require(account != address(0)); require(!has(role, account)); role.bearer[account] = true; }
/** * @dev give an account access to this role */
NatSpecMultiLine
v0.5.17+commit.d19bba13
None
bzzr://cfefed105a08f450eba1a193f0c7cb37af76c84c4dc3c10269331305bff11870
{ "func_code_index": [ 154, 345 ] }
2,090
Bexpress
Bexpress.sol
0xc002141f62961afa759f7b22aaeb151bf80a3d8d
Solidity
Roles
library Roles { struct Role { mapping(address => bool) bearer; } /** * @dev give an account access to this role */ function add(Role storage role, address account) internal { require(account != address(0)); require(!has(role, account)); role.bearer[account] = true; } /** * @dev remove an account's access to this role */ function remove(Role storage role, address account) internal { require(account != address(0)); require(has(role, account)); role.bearer[account] = false; } /** * @dev check if an account has this role * @return bool */ function has(Role storage role, address account) internal view returns (bool) { require(account != address(0)); return role.bearer[account]; } }
/** * @title Roles * @dev Library for managing addresses assigned to a Role. */
NatSpecMultiLine
remove
function remove(Role storage role, address account) internal { require(account != address(0)); require(has(role, account)); role.bearer[account] = false; }
/** * @dev remove an account's access to this role */
NatSpecMultiLine
v0.5.17+commit.d19bba13
None
bzzr://cfefed105a08f450eba1a193f0c7cb37af76c84c4dc3c10269331305bff11870
{ "func_code_index": [ 419, 613 ] }
2,091
Bexpress
Bexpress.sol
0xc002141f62961afa759f7b22aaeb151bf80a3d8d
Solidity
Roles
library Roles { struct Role { mapping(address => bool) bearer; } /** * @dev give an account access to this role */ function add(Role storage role, address account) internal { require(account != address(0)); require(!has(role, account)); role.bearer[account] = true; } /** * @dev remove an account's access to this role */ function remove(Role storage role, address account) internal { require(account != address(0)); require(has(role, account)); role.bearer[account] = false; } /** * @dev check if an account has this role * @return bool */ function has(Role storage role, address account) internal view returns (bool) { require(account != address(0)); return role.bearer[account]; } }
/** * @title Roles * @dev Library for managing addresses assigned to a Role. */
NatSpecMultiLine
has
function has(Role storage role, address account) internal view returns (bool) { require(account != address(0)); return role.bearer[account]; }
/** * @dev check if an account has this role * @return bool */
NatSpecMultiLine
v0.5.17+commit.d19bba13
None
bzzr://cfefed105a08f450eba1a193f0c7cb37af76c84c4dc3c10269331305bff11870
{ "func_code_index": [ 702, 904 ] }
2,092
Bexpress
Bexpress.sol
0xc002141f62961afa759f7b22aaeb151bf80a3d8d
Solidity
ERC20Interface
interface ERC20Interface { // Standard ERC-20 interface. function transfer(address to, uint256 value) external returns (bool); function approve(address spender, uint256 value) external returns (bool); function transferFrom(address from, address to, uint256 value) external returns (bool); function totalSupply() external view returns (uint256); function balanceOf(address who) external view returns (uint256); function allowance(address owner, address spender) external view returns (uint256); // Extension of ERC-20 interface to support supply adjustment. function mint() external returns (bool); function burn(address from, uint256 value) external returns (bool); }
transfer
function transfer(address to, uint256 value) external returns (bool);
// Standard ERC-20 interface.
LineComment
v0.5.17+commit.d19bba13
None
bzzr://cfefed105a08f450eba1a193f0c7cb37af76c84c4dc3c10269331305bff11870
{ "func_code_index": [ 63, 137 ] }
2,093
Bexpress
Bexpress.sol
0xc002141f62961afa759f7b22aaeb151bf80a3d8d
Solidity
ERC20Interface
interface ERC20Interface { // Standard ERC-20 interface. function transfer(address to, uint256 value) external returns (bool); function approve(address spender, uint256 value) external returns (bool); function transferFrom(address from, address to, uint256 value) external returns (bool); function totalSupply() external view returns (uint256); function balanceOf(address who) external view returns (uint256); function allowance(address owner, address spender) external view returns (uint256); // Extension of ERC-20 interface to support supply adjustment. function mint() external returns (bool); function burn(address from, uint256 value) external returns (bool); }
mint
function mint() external returns (bool);
// Extension of ERC-20 interface to support supply adjustment.
LineComment
v0.5.17+commit.d19bba13
None
bzzr://cfefed105a08f450eba1a193f0c7cb37af76c84c4dc3c10269331305bff11870
{ "func_code_index": [ 655, 700 ] }
2,094
ArtexToken
ArtexToken.sol
0x7705faa34b16eb6d77dfc7812be2367ba6b0248e
Solidity
Crowdsale
contract Crowdsale is Owned, Stateful { uint public etherPriceUSDWEI; address public beneficiary; uint public totalLimitUSDWEI; uint public minimalSuccessUSDWEI; uint public collectedUSDWEI; uint public crowdsaleStartTime; uint public crowdsaleFinishTime; uint public tokenPriceUSDWEI = 100000000000000000; struct Investor { uint amountTokens; uint amountWei; } struct BtcDeposit { uint amountBTCWEI; uint btcPriceUSDWEI; address investor; } mapping(bytes32 => BtcDeposit) public btcDeposits; mapping(address => Investor) public investors; mapping(uint => address) public investorsIter; uint public numberOfInvestors; mapping(uint => address) public investorsToWithdrawIter; uint public numberOfInvestorsToWithdraw; function Crowdsale() payable Owned() {} //abstract methods function emitTokens(address _investor, uint _usdwei) internal returns(uint tokensToEmit); function emitAdditionalTokens() internal; function burnTokens(address _address, uint _amount) internal; function() payable crowdsaleState limitNotExceeded crowdsaleNotFinished { uint valueWEI = msg.value; uint valueUSDWEI = valueWEI * etherPriceUSDWEI / 1 ether; if (collectedUSDWEI + valueUSDWEI > totalLimitUSDWEI) { // don't need so much ether valueUSDWEI = totalLimitUSDWEI - collectedUSDWEI; valueWEI = valueUSDWEI * 1 ether / etherPriceUSDWEI; uint weiToReturn = msg.value - valueWEI; bool isSent = msg.sender.call.gas(3000000).value(weiToReturn)(); require(isSent); collectedUSDWEI = totalLimitUSDWEI; // to be sure! } else { collectedUSDWEI += valueUSDWEI; } emitTokensFor(msg.sender, valueUSDWEI, valueWEI); } function depositUSD(address _to, uint _amountUSDWEI) external onlyOwner crowdsaleState limitNotExceeded crowdsaleNotFinished { collectedUSDWEI += _amountUSDWEI; emitTokensFor(_to, _amountUSDWEI, 0); } function depositBTC(address _to, uint _amountBTCWEI, uint _btcPriceUSDWEI, bytes32 _btcTxId) external onlyOwnerOrBtcOracle crowdsaleState limitNotExceeded crowdsaleNotFinished { uint valueUSDWEI = _amountBTCWEI * _btcPriceUSDWEI / 1 ether; BtcDeposit storage btcDep = btcDeposits[_btcTxId]; require(btcDep.amountBTCWEI == 0); btcDep.amountBTCWEI = _amountBTCWEI; btcDep.btcPriceUSDWEI = _btcPriceUSDWEI; btcDep.investor = _to; collectedUSDWEI += valueUSDWEI; emitTokensFor(_to, valueUSDWEI, 0); } function emitTokensFor(address _investor, uint _valueUSDWEI, uint _valueWEI) internal { var emittedTokens = emitTokens(_investor, _valueUSDWEI); Investor storage inv = investors[_investor]; if (inv.amountTokens == 0) { // new investor investorsIter[numberOfInvestors++] = _investor; } inv.amountTokens += emittedTokens; if (state == State.Sale) { inv.amountWei += _valueWEI; } } function startPreSale( address _beneficiary, uint _etherPriceUSDWEI, uint _totalLimitUSDWEI, uint _crowdsaleDurationDays) external onlyOwner { require(state == State.Initial); crowdsaleStartTime = now; beneficiary = _beneficiary; etherPriceUSDWEI = _etherPriceUSDWEI; totalLimitUSDWEI = _totalLimitUSDWEI; crowdsaleFinishTime = now + _crowdsaleDurationDays * 1 days; collectedUSDWEI = 0; setState(State.PreSale); } function finishPreSale() public onlyOwner { require(state == State.PreSale); bool isSent = beneficiary.call.gas(3000000).value(this.balance)(); require(isSent); setState(State.WaitingForSale); } function startSale( address _beneficiary, uint _etherPriceUSDWEI, uint _totalLimitUSDWEI, uint _crowdsaleDurationDays, uint _minimalSuccessUSDWEI) external onlyOwner { require(state == State.WaitingForSale); crowdsaleStartTime = now; beneficiary = _beneficiary; etherPriceUSDWEI = _etherPriceUSDWEI; totalLimitUSDWEI = _totalLimitUSDWEI; crowdsaleFinishTime = now + _crowdsaleDurationDays * 1 days; minimalSuccessUSDWEI = _minimalSuccessUSDWEI; collectedUSDWEI = 0; setState(State.Sale); } function failSale(uint _investorsToProcess) public { require(state == State.Sale); require(now >= crowdsaleFinishTime && collectedUSDWEI < minimalSuccessUSDWEI); while (_investorsToProcess > 0 && numberOfInvestors > 0) { address addr = investorsIter[--numberOfInvestors]; Investor memory inv = investors[addr]; burnTokens(addr, inv.amountTokens); --_investorsToProcess; delete investorsIter[numberOfInvestors]; investorsToWithdrawIter[numberOfInvestorsToWithdraw] = addr; numberOfInvestorsToWithdraw++; } if (numberOfInvestors > 0) { return; } setState(State.SaleFailed); } function completeSale(uint _investorsToProcess) public onlyOwner { require(state == State.Sale); require(collectedUSDWEI >= minimalSuccessUSDWEI); while (_investorsToProcess > 0 && numberOfInvestors > 0) { --numberOfInvestors; --_investorsToProcess; delete investors[investorsIter[numberOfInvestors]]; delete investorsIter[numberOfInvestors]; } if (numberOfInvestors > 0) { return; } emitAdditionalTokens(); bool isSent = beneficiary.call.gas(3000000).value(this.balance)(); require(isSent); setState(State.CrowdsaleCompleted); } function setEtherPriceUSDWEI(uint _etherPriceUSDWEI) external onlyOwnerOrOracle { etherPriceUSDWEI = _etherPriceUSDWEI; } function setBeneficiary(address _beneficiary) external onlyOwner() { require(_beneficiary != 0); beneficiary = _beneficiary; } // This function must be called by token holder in case of crowdsale failed function withdrawBack() external saleFailedState { returnInvestmentsToInternal(msg.sender); } function returnInvestments(uint _investorsToProcess) public saleFailedState { while (_investorsToProcess > 0 && numberOfInvestorsToWithdraw > 0) { address addr = investorsToWithdrawIter[--numberOfInvestorsToWithdraw]; delete investorsToWithdrawIter[numberOfInvestorsToWithdraw]; --_investorsToProcess; returnInvestmentsToInternal(addr); } } function returnInvestmentsTo(address _to) public saleFailedState { returnInvestmentsToInternal(_to); } function returnInvestmentsToInternal(address _to) internal { Investor memory inv = investors[_to]; uint value = inv.amountWei; if (value > 0) { delete investors[_to]; require(_to.call.gas(3000000).value(value)()); } } function withdrawFunds(uint _value) public onlyOwner { require(state == State.PreSale || (state == State.Sale && collectedUSDWEI > minimalSuccessUSDWEI)); if (_value == 0) { _value = this.balance; } bool isSent = beneficiary.call.gas(3000000).value(_value)(); require(isSent); } modifier crowdsaleNotFinished { require(now < crowdsaleFinishTime); _; } modifier limitNotExceeded { require(collectedUSDWEI < totalLimitUSDWEI); _; } modifier crowdsaleState { require(state == State.PreSale || state == State.Sale); _; } modifier saleFailedState { require(state == State.SaleFailed); _; } modifier completedSaleState { require(state == State.CrowdsaleCompleted); _; } }
emitTokens
function emitTokens(address _investor, uint _usdwei) internal returns(uint tokensToEmit);
//abstract methods
LineComment
v0.4.18+commit.9cf6e910
bzzr://06bbc0bf525ce858495eaf3a678c495345c4c11cbd3b9dac4cceec3427b0f5d2
{ "func_code_index": [ 941, 1035 ] }
2,095
ArtexToken
ArtexToken.sol
0x7705faa34b16eb6d77dfc7812be2367ba6b0248e
Solidity
Crowdsale
contract Crowdsale is Owned, Stateful { uint public etherPriceUSDWEI; address public beneficiary; uint public totalLimitUSDWEI; uint public minimalSuccessUSDWEI; uint public collectedUSDWEI; uint public crowdsaleStartTime; uint public crowdsaleFinishTime; uint public tokenPriceUSDWEI = 100000000000000000; struct Investor { uint amountTokens; uint amountWei; } struct BtcDeposit { uint amountBTCWEI; uint btcPriceUSDWEI; address investor; } mapping(bytes32 => BtcDeposit) public btcDeposits; mapping(address => Investor) public investors; mapping(uint => address) public investorsIter; uint public numberOfInvestors; mapping(uint => address) public investorsToWithdrawIter; uint public numberOfInvestorsToWithdraw; function Crowdsale() payable Owned() {} //abstract methods function emitTokens(address _investor, uint _usdwei) internal returns(uint tokensToEmit); function emitAdditionalTokens() internal; function burnTokens(address _address, uint _amount) internal; function() payable crowdsaleState limitNotExceeded crowdsaleNotFinished { uint valueWEI = msg.value; uint valueUSDWEI = valueWEI * etherPriceUSDWEI / 1 ether; if (collectedUSDWEI + valueUSDWEI > totalLimitUSDWEI) { // don't need so much ether valueUSDWEI = totalLimitUSDWEI - collectedUSDWEI; valueWEI = valueUSDWEI * 1 ether / etherPriceUSDWEI; uint weiToReturn = msg.value - valueWEI; bool isSent = msg.sender.call.gas(3000000).value(weiToReturn)(); require(isSent); collectedUSDWEI = totalLimitUSDWEI; // to be sure! } else { collectedUSDWEI += valueUSDWEI; } emitTokensFor(msg.sender, valueUSDWEI, valueWEI); } function depositUSD(address _to, uint _amountUSDWEI) external onlyOwner crowdsaleState limitNotExceeded crowdsaleNotFinished { collectedUSDWEI += _amountUSDWEI; emitTokensFor(_to, _amountUSDWEI, 0); } function depositBTC(address _to, uint _amountBTCWEI, uint _btcPriceUSDWEI, bytes32 _btcTxId) external onlyOwnerOrBtcOracle crowdsaleState limitNotExceeded crowdsaleNotFinished { uint valueUSDWEI = _amountBTCWEI * _btcPriceUSDWEI / 1 ether; BtcDeposit storage btcDep = btcDeposits[_btcTxId]; require(btcDep.amountBTCWEI == 0); btcDep.amountBTCWEI = _amountBTCWEI; btcDep.btcPriceUSDWEI = _btcPriceUSDWEI; btcDep.investor = _to; collectedUSDWEI += valueUSDWEI; emitTokensFor(_to, valueUSDWEI, 0); } function emitTokensFor(address _investor, uint _valueUSDWEI, uint _valueWEI) internal { var emittedTokens = emitTokens(_investor, _valueUSDWEI); Investor storage inv = investors[_investor]; if (inv.amountTokens == 0) { // new investor investorsIter[numberOfInvestors++] = _investor; } inv.amountTokens += emittedTokens; if (state == State.Sale) { inv.amountWei += _valueWEI; } } function startPreSale( address _beneficiary, uint _etherPriceUSDWEI, uint _totalLimitUSDWEI, uint _crowdsaleDurationDays) external onlyOwner { require(state == State.Initial); crowdsaleStartTime = now; beneficiary = _beneficiary; etherPriceUSDWEI = _etherPriceUSDWEI; totalLimitUSDWEI = _totalLimitUSDWEI; crowdsaleFinishTime = now + _crowdsaleDurationDays * 1 days; collectedUSDWEI = 0; setState(State.PreSale); } function finishPreSale() public onlyOwner { require(state == State.PreSale); bool isSent = beneficiary.call.gas(3000000).value(this.balance)(); require(isSent); setState(State.WaitingForSale); } function startSale( address _beneficiary, uint _etherPriceUSDWEI, uint _totalLimitUSDWEI, uint _crowdsaleDurationDays, uint _minimalSuccessUSDWEI) external onlyOwner { require(state == State.WaitingForSale); crowdsaleStartTime = now; beneficiary = _beneficiary; etherPriceUSDWEI = _etherPriceUSDWEI; totalLimitUSDWEI = _totalLimitUSDWEI; crowdsaleFinishTime = now + _crowdsaleDurationDays * 1 days; minimalSuccessUSDWEI = _minimalSuccessUSDWEI; collectedUSDWEI = 0; setState(State.Sale); } function failSale(uint _investorsToProcess) public { require(state == State.Sale); require(now >= crowdsaleFinishTime && collectedUSDWEI < minimalSuccessUSDWEI); while (_investorsToProcess > 0 && numberOfInvestors > 0) { address addr = investorsIter[--numberOfInvestors]; Investor memory inv = investors[addr]; burnTokens(addr, inv.amountTokens); --_investorsToProcess; delete investorsIter[numberOfInvestors]; investorsToWithdrawIter[numberOfInvestorsToWithdraw] = addr; numberOfInvestorsToWithdraw++; } if (numberOfInvestors > 0) { return; } setState(State.SaleFailed); } function completeSale(uint _investorsToProcess) public onlyOwner { require(state == State.Sale); require(collectedUSDWEI >= minimalSuccessUSDWEI); while (_investorsToProcess > 0 && numberOfInvestors > 0) { --numberOfInvestors; --_investorsToProcess; delete investors[investorsIter[numberOfInvestors]]; delete investorsIter[numberOfInvestors]; } if (numberOfInvestors > 0) { return; } emitAdditionalTokens(); bool isSent = beneficiary.call.gas(3000000).value(this.balance)(); require(isSent); setState(State.CrowdsaleCompleted); } function setEtherPriceUSDWEI(uint _etherPriceUSDWEI) external onlyOwnerOrOracle { etherPriceUSDWEI = _etherPriceUSDWEI; } function setBeneficiary(address _beneficiary) external onlyOwner() { require(_beneficiary != 0); beneficiary = _beneficiary; } // This function must be called by token holder in case of crowdsale failed function withdrawBack() external saleFailedState { returnInvestmentsToInternal(msg.sender); } function returnInvestments(uint _investorsToProcess) public saleFailedState { while (_investorsToProcess > 0 && numberOfInvestorsToWithdraw > 0) { address addr = investorsToWithdrawIter[--numberOfInvestorsToWithdraw]; delete investorsToWithdrawIter[numberOfInvestorsToWithdraw]; --_investorsToProcess; returnInvestmentsToInternal(addr); } } function returnInvestmentsTo(address _to) public saleFailedState { returnInvestmentsToInternal(_to); } function returnInvestmentsToInternal(address _to) internal { Investor memory inv = investors[_to]; uint value = inv.amountWei; if (value > 0) { delete investors[_to]; require(_to.call.gas(3000000).value(value)()); } } function withdrawFunds(uint _value) public onlyOwner { require(state == State.PreSale || (state == State.Sale && collectedUSDWEI > minimalSuccessUSDWEI)); if (_value == 0) { _value = this.balance; } bool isSent = beneficiary.call.gas(3000000).value(_value)(); require(isSent); } modifier crowdsaleNotFinished { require(now < crowdsaleFinishTime); _; } modifier limitNotExceeded { require(collectedUSDWEI < totalLimitUSDWEI); _; } modifier crowdsaleState { require(state == State.PreSale || state == State.Sale); _; } modifier saleFailedState { require(state == State.SaleFailed); _; } modifier completedSaleState { require(state == State.CrowdsaleCompleted); _; } }
withdrawBack
function withdrawBack() external saleFailedState { returnInvestmentsToInternal(msg.sender); }
// This function must be called by token holder in case of crowdsale failed
LineComment
v0.4.18+commit.9cf6e910
bzzr://06bbc0bf525ce858495eaf3a678c495345c4c11cbd3b9dac4cceec3427b0f5d2
{ "func_code_index": [ 6515, 6627 ] }
2,096
ArtexToken
ArtexToken.sol
0x7705faa34b16eb6d77dfc7812be2367ba6b0248e
Solidity
MigratableToken
contract MigratableToken is Token { function MigratableToken() payable Token() {} bool stateMigrated = false; address public migrationAgent; uint public totalMigrated; address public migrationHost; mapping(address => bool) migratedInvestors; event Migrated(address indexed from, address indexed to, uint value); function setMigrationHost(address _address) external onlyOwner { require(_address != 0); migrationHost = _address; } function migrateStateFromHost() external onlyOwner { require(stateMigrated == false && migrationHost != 0); PreArtexToken preArtex = PreArtexToken(migrationHost); state = Stateful.State.PreSale; etherPriceUSDWEI = preArtex.etherPriceUSDWEI(); beneficiary = preArtex.beneficiary(); totalLimitUSDWEI = preArtex.totalLimitUSDWEI(); minimalSuccessUSDWEI = preArtex.minimalSuccessUSDWEI(); collectedUSDWEI = preArtex.collectedUSDWEI(); crowdsaleStartTime = preArtex.crowdsaleStartTime(); crowdsaleFinishTime = preArtex.crowdsaleFinishTime(); stateMigrated = true; } function migrateInvestorsFromHost(uint batchSize) external onlyOwner { require(migrationHost != 0); PreArtexToken preArtex = PreArtexToken(migrationHost); uint numberOfInvestorsToMigrate = preArtex.numberOfInvestors(); uint currentNumberOfInvestors = numberOfInvestors; require(currentNumberOfInvestors < numberOfInvestorsToMigrate); for (uint i = 0; i < batchSize; i++) { uint index = currentNumberOfInvestors + i; if (index < numberOfInvestorsToMigrate) { address investor = preArtex.investorsIter(index); migrateInvestorsFromHostInternal(investor, preArtex); } else break; } } function migrateInvestorFromHost(address _address) external onlyOwner { require(migrationHost != 0); PreArtexToken preArtex = PreArtexToken(migrationHost); migrateInvestorsFromHostInternal(_address, preArtex); } function migrateInvestorsFromHostInternal(address _address, PreArtexToken preArtex) internal { require(state != State.SaleFailed && migratedInvestors[_address] == false); var (tokensToTransfer, weiToTransfer) = preArtex.investors(_address); require(tokensToTransfer > 0); balances[_address] = tokensToTransfer; totalSupply += tokensToTransfer; migratedInvestors[_address] = true; if (state != State.CrowdsaleCompleted) { Investor storage investor = investors[_address]; investorsIter[numberOfInvestors] = _address; numberOfInvestors++; investor.amountTokens += tokensToTransfer; investor.amountWei += weiToTransfer; } Transfer(this, _address, tokensToTransfer); } //migration by investor function migrate() external { require(migrationAgent != 0); uint value = balances[msg.sender]; balances[msg.sender] -= value; Transfer(msg.sender, this, value); totalSupply -= value; totalMigrated += value; MigrationAgent(migrationAgent).migrateFrom(msg.sender, value); Migrated(msg.sender, migrationAgent, value); } function setMigrationAgent(address _agent) external onlyOwner { require(migrationAgent == 0); migrationAgent = _agent; } }
migrate
function migrate() external { require(migrationAgent != 0); uint value = balances[msg.sender]; balances[msg.sender] -= value; Transfer(msg.sender, this, value); totalSupply -= value; totalMigrated += value; MigrationAgent(migrationAgent).migrateFrom(msg.sender, value); Migrated(msg.sender, migrationAgent, value); }
//migration by investor
LineComment
v0.4.18+commit.9cf6e910
bzzr://06bbc0bf525ce858495eaf3a678c495345c4c11cbd3b9dac4cceec3427b0f5d2
{ "func_code_index": [ 3099, 3497 ] }
2,097
GmStudioMindTheGap
contracts/collections/MindTheGap/MindTheGap.sol
0x0e42ffbac75bcc30cd0015f8aaa608539ba35fbb
Solidity
GmStudioMindTheGap
contract GmStudioMindTheGap is ERC721Common, ReentrancyGuard, ERC2981SinglePercentual { using EnumerableSet for EnumerableSet.AddressSet; using SignatureChecker for EnumerableSet.AddressSet; using Address for address payable; /// @notice Price for minting uint256 public constant MINT_PRICE = 0.15 ether; /// @notice Splits payments between the Studio and the artist. address payable public immutable paymentSplitter; /// @notice Splits payments between the Studio and the artist. address payable public immutable paymentSplitterRoyalties; /// @notice Total maximum amount of tokens uint32 public constant MAX_NUM_TOKENS = 999; /// @notice Max number of mints per transaction. /// @dev Only for public mints. uint32 public constant MAX_MINT_PER_TX = 1; /// @notice Number of mints throught the signed minting interface. uint32 internal constant NUM_SIGNED_MINTS = 300; /// @notice Number of mints for reserved the studio. uint32 internal constant NUM_RESERVED_MINTS = 1; /// @notice Currently minted supply of tokens uint32 public totalSupply; /// @notice Counter for the remaining signed mints uint32 internal numSignedMintsRemaining; /// @notice Locks the mintReserve function bool internal reserveMinted; /// @notice Locks the code storing function bool internal codeStoreLocked; /// @notice Timestamps to enables/eisables minting interfaces /// @dev The following order is assumed /// signedMintOpeningTimestamp < publicMintOpeningTimestamp < mintClosingTimestamp struct MintConfig { uint64 signedMintOpeningTimestamp; uint64 publicMintOpeningTimestamp; uint64 mintClosingTimestamp; } /// @notice The minting configuration MintConfig public mintConfig; /// @notice Stores the number of tokens minted from a signature /// @dev Used in mintSigned mapping(bytes32 => uint256) public numSignedMintsFrom; /// @notice Signature signers for the early access phase. /// @dev Removing signers invalidates the corresponding signatures. EnumerableSet.AddressSet private _signers; /// @notice tokenURI() base path. /// @dev Without trailing slash string internal _baseTokenURI; constructor( address newOwner, address signer, string memory baseTokenURI, address[] memory payees, uint256[] memory shares, uint256[] memory sharesRoyalties ) ERC721Common("Mind the Gap by MountVitruvius", "MTG") { _signers.add(signer); _baseTokenURI = baseTokenURI; paymentSplitter = payable( PaymentSplitterDeployer.instance().deploy(payees, shares) ); paymentSplitterRoyalties = payable( PaymentSplitterDeployer.instance().deploy(payees, sharesRoyalties) ); _setRoyaltyPercentage(750); _setRoyaltyReceiver(paymentSplitterRoyalties); numSignedMintsRemaining = NUM_SIGNED_MINTS; transferOwnership(newOwner); } // ------------------------------------------------------------------------- // // Minting // // ------------------------------------------------------------------------- /// @notice Toggle minting relevant flags. function setMintConfig(MintConfig calldata config) external onlyOwner { mintConfig = config; } /// @dev Reverts if we are not in the signed minting window or the if /// `mintConfig` has not been set yet. modifier onlyDuringSignedMintingPeriod() { if ( block.timestamp < mintConfig.signedMintOpeningTimestamp || block.timestamp > mintConfig.publicMintOpeningTimestamp ) revert MintDisabled(); _; } /// @dev Reverts if we are not in the public minting window or the if /// `mintConfig` has not been set yet. modifier onlyDuringPublicMintingPeriod() { if ( block.timestamp < mintConfig.publicMintOpeningTimestamp || block.timestamp > mintConfig.mintClosingTimestamp ) revert MintDisabled(); _; } /// @notice Mints tokens to a given address using a signed message. /// @dev The minter might be different than the receiver. /// @param to Token receiver /// @param num Number of tokens to be minted. /// @param numMax Max number of tokens that can be minted to the receiver /// @param signature to prove that the receiver is allowed to get mints. /// @dev The signed messages is generated from `to || numMax`. function mintSigned( address to, uint32 num, uint32 numMax, uint256 nonce, bytes calldata signature ) external payable nonReentrant onlyDuringSignedMintingPeriod { bytes32 message = ECDSA.toEthSignedMessageHash( abi.encodePacked(to, numMax, nonce) ); if (num + numSignedMintsFrom[message] > numMax) revert TooManyMintsRequested(); if (num > numSignedMintsRemaining) revert InsufficientTokensRemanining(); if (num * MINT_PRICE != msg.value) revert InvalidPayment(); _signers.requireValidSignature(message, signature); numSignedMintsFrom[message] += num; numSignedMintsRemaining -= num; _processPayment(); _processMint(to, num); } /// @notice Mints tokens to a given address. /// @dev The minter might be different than the receiver. /// @param to Token receiver /// @param num Number of tokens to be minted. function mintPublic(address to, uint32 num) external payable nonReentrant onlyDuringPublicMintingPeriod { if (num > MAX_MINT_PER_TX) revert TooManyMintsRequested(); uint256 numRemaining = MAX_NUM_TOKENS - totalSupply; if (num > numRemaining) revert InsufficientTokensRemanining(); if (num * MINT_PRICE != msg.value) revert InvalidPayment(); _processPayment(); _processMint(to, num); } /// @notice Mints the DAO allocated tokens. /// @dev The minter might be different than the receiver. /// @param to Token receiver function mintReserve(address to) external onlyOwner { if (reserveMinted) revert MintDisabled(); reserveMinted = true; _processMint(to, NUM_RESERVED_MINTS); } /// @notice Mints new tokens for the recipient. function _processMint(address to, uint32 num) internal { uint32 supply = totalSupply; for (uint256 i = 0; i < num; i++) { if (MAX_NUM_TOKENS <= supply) revert SoldOut(); ERC721._safeMint(to, supply); supply++; } totalSupply = supply; } // ------------------------------------------------------------------------- // // Signature validataion // // ------------------------------------------------------------------------- /// @notice Removes and adds addresses to the set of allowed signers. /// @dev Removal is performed before addition. function changeSigners( address[] calldata delSigners, address[] calldata addSigners ) external onlyOwner { for (uint256 idx; idx < delSigners.length; ++idx) { _signers.remove(delSigners[idx]); } for (uint256 idx; idx < addSigners.length; ++idx) { _signers.add(addSigners[idx]); } } /// @notice Returns the addresses that are used for signature verification function getSigners() external view returns (address[] memory signers) { uint256 len = _signers.length(); signers = new address[](len); for (uint256 idx = 0; idx < len; ++idx) { signers[idx] = _signers.at(idx); } } // ------------------------------------------------------------------------- // // Payment // // ------------------------------------------------------------------------- /// @notice Default function for receiving funds /// @dev This enables the contract to be used as splitter for royalties. receive() external payable { _processPayment(); } /// @notice Processes an incoming payment and sends it to the payment /// splitter. function _processPayment() internal { paymentSplitter.sendValue(msg.value); } // ------------------------------------------------------------------------- // // Metadata // // ------------------------------------------------------------------------- /// @notice This function is intended to store (genart) code onchain in // calldata. function storeCode(bytes calldata) external { if ( codeStoreLocked || (mintConfig.signedMintOpeningTimestamp > 0 && block.timestamp > mintConfig.signedMintOpeningTimestamp) ) revert CodeStoreLocked(); codeStoreLocked = true; } /// @notice Change tokenURI() base path. /// @param uri The new base path (must not contain trailing slash) function setBaseTokenURI(string calldata uri) external onlyOwner { _baseTokenURI = uri; } /// @notice Returns the URI for token metadata. function tokenURI(uint256 tokenId) public view override tokenExists(tokenId) returns (string memory) { return string( abi.encodePacked( _baseTokenURI, "/", Strings.toString(tokenId), ".json" ) ); } // ------------------------------------------------------------------------- // // Internals // // ------------------------------------------------------------------------- /// @dev See {IERC165-supportsInterface}. function supportsInterface(bytes4 interfaceId) public view virtual override(ERC721Common, ERC2981) returns (bool) { return super.supportsInterface(interfaceId); } // ------------------------------------------------------------------------- // // Errors // // ------------------------------------------------------------------------- error MintDisabled(); error TooManyMintsRequested(); error InsufficientTokensRemanining(); error InvalidPayment(); error SoldOut(); error InvalidSignature(); error ExeedsOwnerAllocation(); error NotAllowedToOwnerMint(); error NotAllowToChangeAddress(); error CodeStoreLocked(); }
// __ __ __ // | \ | \ \ // ______ ______ ____ _______ _| β–“β–“_ __ __ ____| β–“β–“\β–“β–“ ______ // / \| \ \ / \ β–“β–“ \ | \ | \/ β–“β–“ \/ \ // | β–“β–“β–“β–“β–“β–“\ β–“β–“β–“β–“β–“β–“\β–“β–“β–“β–“\ | β–“β–“β–“β–“β–“β–“β–“\β–“β–“β–“β–“β–“β–“ | β–“β–“ | β–“β–“ β–“β–“β–“β–“β–“β–“β–“ β–“β–“ β–“β–“β–“β–“β–“β–“\ // | β–“β–“ | β–“β–“ β–“β–“ | β–“β–“ | β–“β–“ \β–“β–“ \ | β–“β–“ __| β–“β–“ | β–“β–“ β–“β–“ | β–“β–“ β–“β–“ β–“β–“ | β–“β–“ // | β–“β–“__| β–“β–“ β–“β–“ | β–“β–“ | β–“β–“__ _\β–“β–“β–“β–“β–“β–“\ | β–“β–“| \ β–“β–“__/ β–“β–“ β–“β–“__| β–“β–“ β–“β–“ β–“β–“__/ β–“β–“ // \β–“β–“ β–“β–“ β–“β–“ | β–“β–“ | β–“β–“ \ | β–“β–“ \β–“β–“ β–“β–“\β–“β–“ β–“β–“\β–“β–“ β–“β–“ β–“β–“\β–“β–“ β–“β–“ // _\β–“β–“β–“β–“β–“β–“β–“\β–“β–“ \β–“β–“ \β–“β–“\β–“β–“ \β–“β–“β–“β–“β–“β–“β–“ \β–“β–“β–“β–“ \β–“β–“β–“β–“β–“β–“ \β–“β–“β–“β–“β–“β–“β–“\β–“β–“ \β–“β–“β–“β–“β–“β–“ // | \__| β–“β–“ // \β–“β–“ β–“β–“ // \β–“β–“β–“β–“β–“β–“ //
LineComment
setMintConfig
function setMintConfig(MintConfig calldata config) external onlyOwner { mintConfig = config; }
/// @notice Toggle minting relevant flags.
NatSpecSingleLine
v0.8.11+commit.d7f03943
Unlicense
{ "func_code_index": [ 3312, 3422 ] }
2,098
GmStudioMindTheGap
contracts/collections/MindTheGap/MindTheGap.sol
0x0e42ffbac75bcc30cd0015f8aaa608539ba35fbb
Solidity
GmStudioMindTheGap
contract GmStudioMindTheGap is ERC721Common, ReentrancyGuard, ERC2981SinglePercentual { using EnumerableSet for EnumerableSet.AddressSet; using SignatureChecker for EnumerableSet.AddressSet; using Address for address payable; /// @notice Price for minting uint256 public constant MINT_PRICE = 0.15 ether; /// @notice Splits payments between the Studio and the artist. address payable public immutable paymentSplitter; /// @notice Splits payments between the Studio and the artist. address payable public immutable paymentSplitterRoyalties; /// @notice Total maximum amount of tokens uint32 public constant MAX_NUM_TOKENS = 999; /// @notice Max number of mints per transaction. /// @dev Only for public mints. uint32 public constant MAX_MINT_PER_TX = 1; /// @notice Number of mints throught the signed minting interface. uint32 internal constant NUM_SIGNED_MINTS = 300; /// @notice Number of mints for reserved the studio. uint32 internal constant NUM_RESERVED_MINTS = 1; /// @notice Currently minted supply of tokens uint32 public totalSupply; /// @notice Counter for the remaining signed mints uint32 internal numSignedMintsRemaining; /// @notice Locks the mintReserve function bool internal reserveMinted; /// @notice Locks the code storing function bool internal codeStoreLocked; /// @notice Timestamps to enables/eisables minting interfaces /// @dev The following order is assumed /// signedMintOpeningTimestamp < publicMintOpeningTimestamp < mintClosingTimestamp struct MintConfig { uint64 signedMintOpeningTimestamp; uint64 publicMintOpeningTimestamp; uint64 mintClosingTimestamp; } /// @notice The minting configuration MintConfig public mintConfig; /// @notice Stores the number of tokens minted from a signature /// @dev Used in mintSigned mapping(bytes32 => uint256) public numSignedMintsFrom; /// @notice Signature signers for the early access phase. /// @dev Removing signers invalidates the corresponding signatures. EnumerableSet.AddressSet private _signers; /// @notice tokenURI() base path. /// @dev Without trailing slash string internal _baseTokenURI; constructor( address newOwner, address signer, string memory baseTokenURI, address[] memory payees, uint256[] memory shares, uint256[] memory sharesRoyalties ) ERC721Common("Mind the Gap by MountVitruvius", "MTG") { _signers.add(signer); _baseTokenURI = baseTokenURI; paymentSplitter = payable( PaymentSplitterDeployer.instance().deploy(payees, shares) ); paymentSplitterRoyalties = payable( PaymentSplitterDeployer.instance().deploy(payees, sharesRoyalties) ); _setRoyaltyPercentage(750); _setRoyaltyReceiver(paymentSplitterRoyalties); numSignedMintsRemaining = NUM_SIGNED_MINTS; transferOwnership(newOwner); } // ------------------------------------------------------------------------- // // Minting // // ------------------------------------------------------------------------- /// @notice Toggle minting relevant flags. function setMintConfig(MintConfig calldata config) external onlyOwner { mintConfig = config; } /// @dev Reverts if we are not in the signed minting window or the if /// `mintConfig` has not been set yet. modifier onlyDuringSignedMintingPeriod() { if ( block.timestamp < mintConfig.signedMintOpeningTimestamp || block.timestamp > mintConfig.publicMintOpeningTimestamp ) revert MintDisabled(); _; } /// @dev Reverts if we are not in the public minting window or the if /// `mintConfig` has not been set yet. modifier onlyDuringPublicMintingPeriod() { if ( block.timestamp < mintConfig.publicMintOpeningTimestamp || block.timestamp > mintConfig.mintClosingTimestamp ) revert MintDisabled(); _; } /// @notice Mints tokens to a given address using a signed message. /// @dev The minter might be different than the receiver. /// @param to Token receiver /// @param num Number of tokens to be minted. /// @param numMax Max number of tokens that can be minted to the receiver /// @param signature to prove that the receiver is allowed to get mints. /// @dev The signed messages is generated from `to || numMax`. function mintSigned( address to, uint32 num, uint32 numMax, uint256 nonce, bytes calldata signature ) external payable nonReentrant onlyDuringSignedMintingPeriod { bytes32 message = ECDSA.toEthSignedMessageHash( abi.encodePacked(to, numMax, nonce) ); if (num + numSignedMintsFrom[message] > numMax) revert TooManyMintsRequested(); if (num > numSignedMintsRemaining) revert InsufficientTokensRemanining(); if (num * MINT_PRICE != msg.value) revert InvalidPayment(); _signers.requireValidSignature(message, signature); numSignedMintsFrom[message] += num; numSignedMintsRemaining -= num; _processPayment(); _processMint(to, num); } /// @notice Mints tokens to a given address. /// @dev The minter might be different than the receiver. /// @param to Token receiver /// @param num Number of tokens to be minted. function mintPublic(address to, uint32 num) external payable nonReentrant onlyDuringPublicMintingPeriod { if (num > MAX_MINT_PER_TX) revert TooManyMintsRequested(); uint256 numRemaining = MAX_NUM_TOKENS - totalSupply; if (num > numRemaining) revert InsufficientTokensRemanining(); if (num * MINT_PRICE != msg.value) revert InvalidPayment(); _processPayment(); _processMint(to, num); } /// @notice Mints the DAO allocated tokens. /// @dev The minter might be different than the receiver. /// @param to Token receiver function mintReserve(address to) external onlyOwner { if (reserveMinted) revert MintDisabled(); reserveMinted = true; _processMint(to, NUM_RESERVED_MINTS); } /// @notice Mints new tokens for the recipient. function _processMint(address to, uint32 num) internal { uint32 supply = totalSupply; for (uint256 i = 0; i < num; i++) { if (MAX_NUM_TOKENS <= supply) revert SoldOut(); ERC721._safeMint(to, supply); supply++; } totalSupply = supply; } // ------------------------------------------------------------------------- // // Signature validataion // // ------------------------------------------------------------------------- /// @notice Removes and adds addresses to the set of allowed signers. /// @dev Removal is performed before addition. function changeSigners( address[] calldata delSigners, address[] calldata addSigners ) external onlyOwner { for (uint256 idx; idx < delSigners.length; ++idx) { _signers.remove(delSigners[idx]); } for (uint256 idx; idx < addSigners.length; ++idx) { _signers.add(addSigners[idx]); } } /// @notice Returns the addresses that are used for signature verification function getSigners() external view returns (address[] memory signers) { uint256 len = _signers.length(); signers = new address[](len); for (uint256 idx = 0; idx < len; ++idx) { signers[idx] = _signers.at(idx); } } // ------------------------------------------------------------------------- // // Payment // // ------------------------------------------------------------------------- /// @notice Default function for receiving funds /// @dev This enables the contract to be used as splitter for royalties. receive() external payable { _processPayment(); } /// @notice Processes an incoming payment and sends it to the payment /// splitter. function _processPayment() internal { paymentSplitter.sendValue(msg.value); } // ------------------------------------------------------------------------- // // Metadata // // ------------------------------------------------------------------------- /// @notice This function is intended to store (genart) code onchain in // calldata. function storeCode(bytes calldata) external { if ( codeStoreLocked || (mintConfig.signedMintOpeningTimestamp > 0 && block.timestamp > mintConfig.signedMintOpeningTimestamp) ) revert CodeStoreLocked(); codeStoreLocked = true; } /// @notice Change tokenURI() base path. /// @param uri The new base path (must not contain trailing slash) function setBaseTokenURI(string calldata uri) external onlyOwner { _baseTokenURI = uri; } /// @notice Returns the URI for token metadata. function tokenURI(uint256 tokenId) public view override tokenExists(tokenId) returns (string memory) { return string( abi.encodePacked( _baseTokenURI, "/", Strings.toString(tokenId), ".json" ) ); } // ------------------------------------------------------------------------- // // Internals // // ------------------------------------------------------------------------- /// @dev See {IERC165-supportsInterface}. function supportsInterface(bytes4 interfaceId) public view virtual override(ERC721Common, ERC2981) returns (bool) { return super.supportsInterface(interfaceId); } // ------------------------------------------------------------------------- // // Errors // // ------------------------------------------------------------------------- error MintDisabled(); error TooManyMintsRequested(); error InsufficientTokensRemanining(); error InvalidPayment(); error SoldOut(); error InvalidSignature(); error ExeedsOwnerAllocation(); error NotAllowedToOwnerMint(); error NotAllowToChangeAddress(); error CodeStoreLocked(); }
// __ __ __ // | \ | \ \ // ______ ______ ____ _______ _| β–“β–“_ __ __ ____| β–“β–“\β–“β–“ ______ // / \| \ \ / \ β–“β–“ \ | \ | \/ β–“β–“ \/ \ // | β–“β–“β–“β–“β–“β–“\ β–“β–“β–“β–“β–“β–“\β–“β–“β–“β–“\ | β–“β–“β–“β–“β–“β–“β–“\β–“β–“β–“β–“β–“β–“ | β–“β–“ | β–“β–“ β–“β–“β–“β–“β–“β–“β–“ β–“β–“ β–“β–“β–“β–“β–“β–“\ // | β–“β–“ | β–“β–“ β–“β–“ | β–“β–“ | β–“β–“ \β–“β–“ \ | β–“β–“ __| β–“β–“ | β–“β–“ β–“β–“ | β–“β–“ β–“β–“ β–“β–“ | β–“β–“ // | β–“β–“__| β–“β–“ β–“β–“ | β–“β–“ | β–“β–“__ _\β–“β–“β–“β–“β–“β–“\ | β–“β–“| \ β–“β–“__/ β–“β–“ β–“β–“__| β–“β–“ β–“β–“ β–“β–“__/ β–“β–“ // \β–“β–“ β–“β–“ β–“β–“ | β–“β–“ | β–“β–“ \ | β–“β–“ \β–“β–“ β–“β–“\β–“β–“ β–“β–“\β–“β–“ β–“β–“ β–“β–“\β–“β–“ β–“β–“ // _\β–“β–“β–“β–“β–“β–“β–“\β–“β–“ \β–“β–“ \β–“β–“\β–“β–“ \β–“β–“β–“β–“β–“β–“β–“ \β–“β–“β–“β–“ \β–“β–“β–“β–“β–“β–“ \β–“β–“β–“β–“β–“β–“β–“\β–“β–“ \β–“β–“β–“β–“β–“β–“ // | \__| β–“β–“ // \β–“β–“ β–“β–“ // \β–“β–“β–“β–“β–“β–“ //
LineComment
mintSigned
function mintSigned( address to, uint32 num, uint32 numMax, uint256 nonce, bytes calldata signature ) external payable nonReentrant onlyDuringSignedMintingPeriod { bytes32 message = ECDSA.toEthSignedMessageHash( abi.encodePacked(to, numMax, nonce) ); if (num + numSignedMintsFrom[message] > numMax) revert TooManyMintsRequested(); if (num > numSignedMintsRemaining) revert InsufficientTokensRemanining(); if (num * MINT_PRICE != msg.value) revert InvalidPayment(); _signers.requireValidSignature(message, signature); numSignedMintsFrom[message] += num; numSignedMintsRemaining -= num; _processPayment(); _processMint(to, num); }
/// @notice Mints tokens to a given address using a signed message. /// @dev The minter might be different than the receiver. /// @param to Token receiver /// @param num Number of tokens to be minted. /// @param numMax Max number of tokens that can be minted to the receiver /// @param signature to prove that the receiver is allowed to get mints. /// @dev The signed messages is generated from `to || numMax`.
NatSpecSingleLine
v0.8.11+commit.d7f03943
Unlicense
{ "func_code_index": [ 4591, 5392 ] }
2,099
GmStudioMindTheGap
contracts/collections/MindTheGap/MindTheGap.sol
0x0e42ffbac75bcc30cd0015f8aaa608539ba35fbb
Solidity
GmStudioMindTheGap
contract GmStudioMindTheGap is ERC721Common, ReentrancyGuard, ERC2981SinglePercentual { using EnumerableSet for EnumerableSet.AddressSet; using SignatureChecker for EnumerableSet.AddressSet; using Address for address payable; /// @notice Price for minting uint256 public constant MINT_PRICE = 0.15 ether; /// @notice Splits payments between the Studio and the artist. address payable public immutable paymentSplitter; /// @notice Splits payments between the Studio and the artist. address payable public immutable paymentSplitterRoyalties; /// @notice Total maximum amount of tokens uint32 public constant MAX_NUM_TOKENS = 999; /// @notice Max number of mints per transaction. /// @dev Only for public mints. uint32 public constant MAX_MINT_PER_TX = 1; /// @notice Number of mints throught the signed minting interface. uint32 internal constant NUM_SIGNED_MINTS = 300; /// @notice Number of mints for reserved the studio. uint32 internal constant NUM_RESERVED_MINTS = 1; /// @notice Currently minted supply of tokens uint32 public totalSupply; /// @notice Counter for the remaining signed mints uint32 internal numSignedMintsRemaining; /// @notice Locks the mintReserve function bool internal reserveMinted; /// @notice Locks the code storing function bool internal codeStoreLocked; /// @notice Timestamps to enables/eisables minting interfaces /// @dev The following order is assumed /// signedMintOpeningTimestamp < publicMintOpeningTimestamp < mintClosingTimestamp struct MintConfig { uint64 signedMintOpeningTimestamp; uint64 publicMintOpeningTimestamp; uint64 mintClosingTimestamp; } /// @notice The minting configuration MintConfig public mintConfig; /// @notice Stores the number of tokens minted from a signature /// @dev Used in mintSigned mapping(bytes32 => uint256) public numSignedMintsFrom; /// @notice Signature signers for the early access phase. /// @dev Removing signers invalidates the corresponding signatures. EnumerableSet.AddressSet private _signers; /// @notice tokenURI() base path. /// @dev Without trailing slash string internal _baseTokenURI; constructor( address newOwner, address signer, string memory baseTokenURI, address[] memory payees, uint256[] memory shares, uint256[] memory sharesRoyalties ) ERC721Common("Mind the Gap by MountVitruvius", "MTG") { _signers.add(signer); _baseTokenURI = baseTokenURI; paymentSplitter = payable( PaymentSplitterDeployer.instance().deploy(payees, shares) ); paymentSplitterRoyalties = payable( PaymentSplitterDeployer.instance().deploy(payees, sharesRoyalties) ); _setRoyaltyPercentage(750); _setRoyaltyReceiver(paymentSplitterRoyalties); numSignedMintsRemaining = NUM_SIGNED_MINTS; transferOwnership(newOwner); } // ------------------------------------------------------------------------- // // Minting // // ------------------------------------------------------------------------- /// @notice Toggle minting relevant flags. function setMintConfig(MintConfig calldata config) external onlyOwner { mintConfig = config; } /// @dev Reverts if we are not in the signed minting window or the if /// `mintConfig` has not been set yet. modifier onlyDuringSignedMintingPeriod() { if ( block.timestamp < mintConfig.signedMintOpeningTimestamp || block.timestamp > mintConfig.publicMintOpeningTimestamp ) revert MintDisabled(); _; } /// @dev Reverts if we are not in the public minting window or the if /// `mintConfig` has not been set yet. modifier onlyDuringPublicMintingPeriod() { if ( block.timestamp < mintConfig.publicMintOpeningTimestamp || block.timestamp > mintConfig.mintClosingTimestamp ) revert MintDisabled(); _; } /// @notice Mints tokens to a given address using a signed message. /// @dev The minter might be different than the receiver. /// @param to Token receiver /// @param num Number of tokens to be minted. /// @param numMax Max number of tokens that can be minted to the receiver /// @param signature to prove that the receiver is allowed to get mints. /// @dev The signed messages is generated from `to || numMax`. function mintSigned( address to, uint32 num, uint32 numMax, uint256 nonce, bytes calldata signature ) external payable nonReentrant onlyDuringSignedMintingPeriod { bytes32 message = ECDSA.toEthSignedMessageHash( abi.encodePacked(to, numMax, nonce) ); if (num + numSignedMintsFrom[message] > numMax) revert TooManyMintsRequested(); if (num > numSignedMintsRemaining) revert InsufficientTokensRemanining(); if (num * MINT_PRICE != msg.value) revert InvalidPayment(); _signers.requireValidSignature(message, signature); numSignedMintsFrom[message] += num; numSignedMintsRemaining -= num; _processPayment(); _processMint(to, num); } /// @notice Mints tokens to a given address. /// @dev The minter might be different than the receiver. /// @param to Token receiver /// @param num Number of tokens to be minted. function mintPublic(address to, uint32 num) external payable nonReentrant onlyDuringPublicMintingPeriod { if (num > MAX_MINT_PER_TX) revert TooManyMintsRequested(); uint256 numRemaining = MAX_NUM_TOKENS - totalSupply; if (num > numRemaining) revert InsufficientTokensRemanining(); if (num * MINT_PRICE != msg.value) revert InvalidPayment(); _processPayment(); _processMint(to, num); } /// @notice Mints the DAO allocated tokens. /// @dev The minter might be different than the receiver. /// @param to Token receiver function mintReserve(address to) external onlyOwner { if (reserveMinted) revert MintDisabled(); reserveMinted = true; _processMint(to, NUM_RESERVED_MINTS); } /// @notice Mints new tokens for the recipient. function _processMint(address to, uint32 num) internal { uint32 supply = totalSupply; for (uint256 i = 0; i < num; i++) { if (MAX_NUM_TOKENS <= supply) revert SoldOut(); ERC721._safeMint(to, supply); supply++; } totalSupply = supply; } // ------------------------------------------------------------------------- // // Signature validataion // // ------------------------------------------------------------------------- /// @notice Removes and adds addresses to the set of allowed signers. /// @dev Removal is performed before addition. function changeSigners( address[] calldata delSigners, address[] calldata addSigners ) external onlyOwner { for (uint256 idx; idx < delSigners.length; ++idx) { _signers.remove(delSigners[idx]); } for (uint256 idx; idx < addSigners.length; ++idx) { _signers.add(addSigners[idx]); } } /// @notice Returns the addresses that are used for signature verification function getSigners() external view returns (address[] memory signers) { uint256 len = _signers.length(); signers = new address[](len); for (uint256 idx = 0; idx < len; ++idx) { signers[idx] = _signers.at(idx); } } // ------------------------------------------------------------------------- // // Payment // // ------------------------------------------------------------------------- /// @notice Default function for receiving funds /// @dev This enables the contract to be used as splitter for royalties. receive() external payable { _processPayment(); } /// @notice Processes an incoming payment and sends it to the payment /// splitter. function _processPayment() internal { paymentSplitter.sendValue(msg.value); } // ------------------------------------------------------------------------- // // Metadata // // ------------------------------------------------------------------------- /// @notice This function is intended to store (genart) code onchain in // calldata. function storeCode(bytes calldata) external { if ( codeStoreLocked || (mintConfig.signedMintOpeningTimestamp > 0 && block.timestamp > mintConfig.signedMintOpeningTimestamp) ) revert CodeStoreLocked(); codeStoreLocked = true; } /// @notice Change tokenURI() base path. /// @param uri The new base path (must not contain trailing slash) function setBaseTokenURI(string calldata uri) external onlyOwner { _baseTokenURI = uri; } /// @notice Returns the URI for token metadata. function tokenURI(uint256 tokenId) public view override tokenExists(tokenId) returns (string memory) { return string( abi.encodePacked( _baseTokenURI, "/", Strings.toString(tokenId), ".json" ) ); } // ------------------------------------------------------------------------- // // Internals // // ------------------------------------------------------------------------- /// @dev See {IERC165-supportsInterface}. function supportsInterface(bytes4 interfaceId) public view virtual override(ERC721Common, ERC2981) returns (bool) { return super.supportsInterface(interfaceId); } // ------------------------------------------------------------------------- // // Errors // // ------------------------------------------------------------------------- error MintDisabled(); error TooManyMintsRequested(); error InsufficientTokensRemanining(); error InvalidPayment(); error SoldOut(); error InvalidSignature(); error ExeedsOwnerAllocation(); error NotAllowedToOwnerMint(); error NotAllowToChangeAddress(); error CodeStoreLocked(); }
// __ __ __ // | \ | \ \ // ______ ______ ____ _______ _| β–“β–“_ __ __ ____| β–“β–“\β–“β–“ ______ // / \| \ \ / \ β–“β–“ \ | \ | \/ β–“β–“ \/ \ // | β–“β–“β–“β–“β–“β–“\ β–“β–“β–“β–“β–“β–“\β–“β–“β–“β–“\ | β–“β–“β–“β–“β–“β–“β–“\β–“β–“β–“β–“β–“β–“ | β–“β–“ | β–“β–“ β–“β–“β–“β–“β–“β–“β–“ β–“β–“ β–“β–“β–“β–“β–“β–“\ // | β–“β–“ | β–“β–“ β–“β–“ | β–“β–“ | β–“β–“ \β–“β–“ \ | β–“β–“ __| β–“β–“ | β–“β–“ β–“β–“ | β–“β–“ β–“β–“ β–“β–“ | β–“β–“ // | β–“β–“__| β–“β–“ β–“β–“ | β–“β–“ | β–“β–“__ _\β–“β–“β–“β–“β–“β–“\ | β–“β–“| \ β–“β–“__/ β–“β–“ β–“β–“__| β–“β–“ β–“β–“ β–“β–“__/ β–“β–“ // \β–“β–“ β–“β–“ β–“β–“ | β–“β–“ | β–“β–“ \ | β–“β–“ \β–“β–“ β–“β–“\β–“β–“ β–“β–“\β–“β–“ β–“β–“ β–“β–“\β–“β–“ β–“β–“ // _\β–“β–“β–“β–“β–“β–“β–“\β–“β–“ \β–“β–“ \β–“β–“\β–“β–“ \β–“β–“β–“β–“β–“β–“β–“ \β–“β–“β–“β–“ \β–“β–“β–“β–“β–“β–“ \β–“β–“β–“β–“β–“β–“β–“\β–“β–“ \β–“β–“β–“β–“β–“β–“ // | \__| β–“β–“ // \β–“β–“ β–“β–“ // \β–“β–“β–“β–“β–“β–“ //
LineComment
mintPublic
function mintPublic(address to, uint32 num) external payable nonReentrant onlyDuringPublicMintingPeriod { if (num > MAX_MINT_PER_TX) revert TooManyMintsRequested(); uint256 numRemaining = MAX_NUM_TOKENS - totalSupply; if (num > numRemaining) revert InsufficientTokensRemanining(); if (num * MINT_PRICE != msg.value) revert InvalidPayment(); _processPayment(); _processMint(to, num); }
/// @notice Mints tokens to a given address. /// @dev The minter might be different than the receiver. /// @param to Token receiver /// @param num Number of tokens to be minted.
NatSpecSingleLine
v0.8.11+commit.d7f03943
Unlicense
{ "func_code_index": [ 5588, 6067 ] }
2,100
GmStudioMindTheGap
contracts/collections/MindTheGap/MindTheGap.sol
0x0e42ffbac75bcc30cd0015f8aaa608539ba35fbb
Solidity
GmStudioMindTheGap
contract GmStudioMindTheGap is ERC721Common, ReentrancyGuard, ERC2981SinglePercentual { using EnumerableSet for EnumerableSet.AddressSet; using SignatureChecker for EnumerableSet.AddressSet; using Address for address payable; /// @notice Price for minting uint256 public constant MINT_PRICE = 0.15 ether; /// @notice Splits payments between the Studio and the artist. address payable public immutable paymentSplitter; /// @notice Splits payments between the Studio and the artist. address payable public immutable paymentSplitterRoyalties; /// @notice Total maximum amount of tokens uint32 public constant MAX_NUM_TOKENS = 999; /// @notice Max number of mints per transaction. /// @dev Only for public mints. uint32 public constant MAX_MINT_PER_TX = 1; /// @notice Number of mints throught the signed minting interface. uint32 internal constant NUM_SIGNED_MINTS = 300; /// @notice Number of mints for reserved the studio. uint32 internal constant NUM_RESERVED_MINTS = 1; /// @notice Currently minted supply of tokens uint32 public totalSupply; /// @notice Counter for the remaining signed mints uint32 internal numSignedMintsRemaining; /// @notice Locks the mintReserve function bool internal reserveMinted; /// @notice Locks the code storing function bool internal codeStoreLocked; /// @notice Timestamps to enables/eisables minting interfaces /// @dev The following order is assumed /// signedMintOpeningTimestamp < publicMintOpeningTimestamp < mintClosingTimestamp struct MintConfig { uint64 signedMintOpeningTimestamp; uint64 publicMintOpeningTimestamp; uint64 mintClosingTimestamp; } /// @notice The minting configuration MintConfig public mintConfig; /// @notice Stores the number of tokens minted from a signature /// @dev Used in mintSigned mapping(bytes32 => uint256) public numSignedMintsFrom; /// @notice Signature signers for the early access phase. /// @dev Removing signers invalidates the corresponding signatures. EnumerableSet.AddressSet private _signers; /// @notice tokenURI() base path. /// @dev Without trailing slash string internal _baseTokenURI; constructor( address newOwner, address signer, string memory baseTokenURI, address[] memory payees, uint256[] memory shares, uint256[] memory sharesRoyalties ) ERC721Common("Mind the Gap by MountVitruvius", "MTG") { _signers.add(signer); _baseTokenURI = baseTokenURI; paymentSplitter = payable( PaymentSplitterDeployer.instance().deploy(payees, shares) ); paymentSplitterRoyalties = payable( PaymentSplitterDeployer.instance().deploy(payees, sharesRoyalties) ); _setRoyaltyPercentage(750); _setRoyaltyReceiver(paymentSplitterRoyalties); numSignedMintsRemaining = NUM_SIGNED_MINTS; transferOwnership(newOwner); } // ------------------------------------------------------------------------- // // Minting // // ------------------------------------------------------------------------- /// @notice Toggle minting relevant flags. function setMintConfig(MintConfig calldata config) external onlyOwner { mintConfig = config; } /// @dev Reverts if we are not in the signed minting window or the if /// `mintConfig` has not been set yet. modifier onlyDuringSignedMintingPeriod() { if ( block.timestamp < mintConfig.signedMintOpeningTimestamp || block.timestamp > mintConfig.publicMintOpeningTimestamp ) revert MintDisabled(); _; } /// @dev Reverts if we are not in the public minting window or the if /// `mintConfig` has not been set yet. modifier onlyDuringPublicMintingPeriod() { if ( block.timestamp < mintConfig.publicMintOpeningTimestamp || block.timestamp > mintConfig.mintClosingTimestamp ) revert MintDisabled(); _; } /// @notice Mints tokens to a given address using a signed message. /// @dev The minter might be different than the receiver. /// @param to Token receiver /// @param num Number of tokens to be minted. /// @param numMax Max number of tokens that can be minted to the receiver /// @param signature to prove that the receiver is allowed to get mints. /// @dev The signed messages is generated from `to || numMax`. function mintSigned( address to, uint32 num, uint32 numMax, uint256 nonce, bytes calldata signature ) external payable nonReentrant onlyDuringSignedMintingPeriod { bytes32 message = ECDSA.toEthSignedMessageHash( abi.encodePacked(to, numMax, nonce) ); if (num + numSignedMintsFrom[message] > numMax) revert TooManyMintsRequested(); if (num > numSignedMintsRemaining) revert InsufficientTokensRemanining(); if (num * MINT_PRICE != msg.value) revert InvalidPayment(); _signers.requireValidSignature(message, signature); numSignedMintsFrom[message] += num; numSignedMintsRemaining -= num; _processPayment(); _processMint(to, num); } /// @notice Mints tokens to a given address. /// @dev The minter might be different than the receiver. /// @param to Token receiver /// @param num Number of tokens to be minted. function mintPublic(address to, uint32 num) external payable nonReentrant onlyDuringPublicMintingPeriod { if (num > MAX_MINT_PER_TX) revert TooManyMintsRequested(); uint256 numRemaining = MAX_NUM_TOKENS - totalSupply; if (num > numRemaining) revert InsufficientTokensRemanining(); if (num * MINT_PRICE != msg.value) revert InvalidPayment(); _processPayment(); _processMint(to, num); } /// @notice Mints the DAO allocated tokens. /// @dev The minter might be different than the receiver. /// @param to Token receiver function mintReserve(address to) external onlyOwner { if (reserveMinted) revert MintDisabled(); reserveMinted = true; _processMint(to, NUM_RESERVED_MINTS); } /// @notice Mints new tokens for the recipient. function _processMint(address to, uint32 num) internal { uint32 supply = totalSupply; for (uint256 i = 0; i < num; i++) { if (MAX_NUM_TOKENS <= supply) revert SoldOut(); ERC721._safeMint(to, supply); supply++; } totalSupply = supply; } // ------------------------------------------------------------------------- // // Signature validataion // // ------------------------------------------------------------------------- /// @notice Removes and adds addresses to the set of allowed signers. /// @dev Removal is performed before addition. function changeSigners( address[] calldata delSigners, address[] calldata addSigners ) external onlyOwner { for (uint256 idx; idx < delSigners.length; ++idx) { _signers.remove(delSigners[idx]); } for (uint256 idx; idx < addSigners.length; ++idx) { _signers.add(addSigners[idx]); } } /// @notice Returns the addresses that are used for signature verification function getSigners() external view returns (address[] memory signers) { uint256 len = _signers.length(); signers = new address[](len); for (uint256 idx = 0; idx < len; ++idx) { signers[idx] = _signers.at(idx); } } // ------------------------------------------------------------------------- // // Payment // // ------------------------------------------------------------------------- /// @notice Default function for receiving funds /// @dev This enables the contract to be used as splitter for royalties. receive() external payable { _processPayment(); } /// @notice Processes an incoming payment and sends it to the payment /// splitter. function _processPayment() internal { paymentSplitter.sendValue(msg.value); } // ------------------------------------------------------------------------- // // Metadata // // ------------------------------------------------------------------------- /// @notice This function is intended to store (genart) code onchain in // calldata. function storeCode(bytes calldata) external { if ( codeStoreLocked || (mintConfig.signedMintOpeningTimestamp > 0 && block.timestamp > mintConfig.signedMintOpeningTimestamp) ) revert CodeStoreLocked(); codeStoreLocked = true; } /// @notice Change tokenURI() base path. /// @param uri The new base path (must not contain trailing slash) function setBaseTokenURI(string calldata uri) external onlyOwner { _baseTokenURI = uri; } /// @notice Returns the URI for token metadata. function tokenURI(uint256 tokenId) public view override tokenExists(tokenId) returns (string memory) { return string( abi.encodePacked( _baseTokenURI, "/", Strings.toString(tokenId), ".json" ) ); } // ------------------------------------------------------------------------- // // Internals // // ------------------------------------------------------------------------- /// @dev See {IERC165-supportsInterface}. function supportsInterface(bytes4 interfaceId) public view virtual override(ERC721Common, ERC2981) returns (bool) { return super.supportsInterface(interfaceId); } // ------------------------------------------------------------------------- // // Errors // // ------------------------------------------------------------------------- error MintDisabled(); error TooManyMintsRequested(); error InsufficientTokensRemanining(); error InvalidPayment(); error SoldOut(); error InvalidSignature(); error ExeedsOwnerAllocation(); error NotAllowedToOwnerMint(); error NotAllowToChangeAddress(); error CodeStoreLocked(); }
// __ __ __ // | \ | \ \ // ______ ______ ____ _______ _| β–“β–“_ __ __ ____| β–“β–“\β–“β–“ ______ // / \| \ \ / \ β–“β–“ \ | \ | \/ β–“β–“ \/ \ // | β–“β–“β–“β–“β–“β–“\ β–“β–“β–“β–“β–“β–“\β–“β–“β–“β–“\ | β–“β–“β–“β–“β–“β–“β–“\β–“β–“β–“β–“β–“β–“ | β–“β–“ | β–“β–“ β–“β–“β–“β–“β–“β–“β–“ β–“β–“ β–“β–“β–“β–“β–“β–“\ // | β–“β–“ | β–“β–“ β–“β–“ | β–“β–“ | β–“β–“ \β–“β–“ \ | β–“β–“ __| β–“β–“ | β–“β–“ β–“β–“ | β–“β–“ β–“β–“ β–“β–“ | β–“β–“ // | β–“β–“__| β–“β–“ β–“β–“ | β–“β–“ | β–“β–“__ _\β–“β–“β–“β–“β–“β–“\ | β–“β–“| \ β–“β–“__/ β–“β–“ β–“β–“__| β–“β–“ β–“β–“ β–“β–“__/ β–“β–“ // \β–“β–“ β–“β–“ β–“β–“ | β–“β–“ | β–“β–“ \ | β–“β–“ \β–“β–“ β–“β–“\β–“β–“ β–“β–“\β–“β–“ β–“β–“ β–“β–“\β–“β–“ β–“β–“ // _\β–“β–“β–“β–“β–“β–“β–“\β–“β–“ \β–“β–“ \β–“β–“\β–“β–“ \β–“β–“β–“β–“β–“β–“β–“ \β–“β–“β–“β–“ \β–“β–“β–“β–“β–“β–“ \β–“β–“β–“β–“β–“β–“β–“\β–“β–“ \β–“β–“β–“β–“β–“β–“ // | \__| β–“β–“ // \β–“β–“ β–“β–“ // \β–“β–“β–“β–“β–“β–“ //
LineComment
mintReserve
function mintReserve(address to) external onlyOwner { if (reserveMinted) revert MintDisabled(); reserveMinted = true; _processMint(to, NUM_RESERVED_MINTS); }
/// @notice Mints the DAO allocated tokens. /// @dev The minter might be different than the receiver. /// @param to Token receiver
NatSpecSingleLine
v0.8.11+commit.d7f03943
Unlicense
{ "func_code_index": [ 6212, 6401 ] }
2,101
GmStudioMindTheGap
contracts/collections/MindTheGap/MindTheGap.sol
0x0e42ffbac75bcc30cd0015f8aaa608539ba35fbb
Solidity
GmStudioMindTheGap
contract GmStudioMindTheGap is ERC721Common, ReentrancyGuard, ERC2981SinglePercentual { using EnumerableSet for EnumerableSet.AddressSet; using SignatureChecker for EnumerableSet.AddressSet; using Address for address payable; /// @notice Price for minting uint256 public constant MINT_PRICE = 0.15 ether; /// @notice Splits payments between the Studio and the artist. address payable public immutable paymentSplitter; /// @notice Splits payments between the Studio and the artist. address payable public immutable paymentSplitterRoyalties; /// @notice Total maximum amount of tokens uint32 public constant MAX_NUM_TOKENS = 999; /// @notice Max number of mints per transaction. /// @dev Only for public mints. uint32 public constant MAX_MINT_PER_TX = 1; /// @notice Number of mints throught the signed minting interface. uint32 internal constant NUM_SIGNED_MINTS = 300; /// @notice Number of mints for reserved the studio. uint32 internal constant NUM_RESERVED_MINTS = 1; /// @notice Currently minted supply of tokens uint32 public totalSupply; /// @notice Counter for the remaining signed mints uint32 internal numSignedMintsRemaining; /// @notice Locks the mintReserve function bool internal reserveMinted; /// @notice Locks the code storing function bool internal codeStoreLocked; /// @notice Timestamps to enables/eisables minting interfaces /// @dev The following order is assumed /// signedMintOpeningTimestamp < publicMintOpeningTimestamp < mintClosingTimestamp struct MintConfig { uint64 signedMintOpeningTimestamp; uint64 publicMintOpeningTimestamp; uint64 mintClosingTimestamp; } /// @notice The minting configuration MintConfig public mintConfig; /// @notice Stores the number of tokens minted from a signature /// @dev Used in mintSigned mapping(bytes32 => uint256) public numSignedMintsFrom; /// @notice Signature signers for the early access phase. /// @dev Removing signers invalidates the corresponding signatures. EnumerableSet.AddressSet private _signers; /// @notice tokenURI() base path. /// @dev Without trailing slash string internal _baseTokenURI; constructor( address newOwner, address signer, string memory baseTokenURI, address[] memory payees, uint256[] memory shares, uint256[] memory sharesRoyalties ) ERC721Common("Mind the Gap by MountVitruvius", "MTG") { _signers.add(signer); _baseTokenURI = baseTokenURI; paymentSplitter = payable( PaymentSplitterDeployer.instance().deploy(payees, shares) ); paymentSplitterRoyalties = payable( PaymentSplitterDeployer.instance().deploy(payees, sharesRoyalties) ); _setRoyaltyPercentage(750); _setRoyaltyReceiver(paymentSplitterRoyalties); numSignedMintsRemaining = NUM_SIGNED_MINTS; transferOwnership(newOwner); } // ------------------------------------------------------------------------- // // Minting // // ------------------------------------------------------------------------- /// @notice Toggle minting relevant flags. function setMintConfig(MintConfig calldata config) external onlyOwner { mintConfig = config; } /// @dev Reverts if we are not in the signed minting window or the if /// `mintConfig` has not been set yet. modifier onlyDuringSignedMintingPeriod() { if ( block.timestamp < mintConfig.signedMintOpeningTimestamp || block.timestamp > mintConfig.publicMintOpeningTimestamp ) revert MintDisabled(); _; } /// @dev Reverts if we are not in the public minting window or the if /// `mintConfig` has not been set yet. modifier onlyDuringPublicMintingPeriod() { if ( block.timestamp < mintConfig.publicMintOpeningTimestamp || block.timestamp > mintConfig.mintClosingTimestamp ) revert MintDisabled(); _; } /// @notice Mints tokens to a given address using a signed message. /// @dev The minter might be different than the receiver. /// @param to Token receiver /// @param num Number of tokens to be minted. /// @param numMax Max number of tokens that can be minted to the receiver /// @param signature to prove that the receiver is allowed to get mints. /// @dev The signed messages is generated from `to || numMax`. function mintSigned( address to, uint32 num, uint32 numMax, uint256 nonce, bytes calldata signature ) external payable nonReentrant onlyDuringSignedMintingPeriod { bytes32 message = ECDSA.toEthSignedMessageHash( abi.encodePacked(to, numMax, nonce) ); if (num + numSignedMintsFrom[message] > numMax) revert TooManyMintsRequested(); if (num > numSignedMintsRemaining) revert InsufficientTokensRemanining(); if (num * MINT_PRICE != msg.value) revert InvalidPayment(); _signers.requireValidSignature(message, signature); numSignedMintsFrom[message] += num; numSignedMintsRemaining -= num; _processPayment(); _processMint(to, num); } /// @notice Mints tokens to a given address. /// @dev The minter might be different than the receiver. /// @param to Token receiver /// @param num Number of tokens to be minted. function mintPublic(address to, uint32 num) external payable nonReentrant onlyDuringPublicMintingPeriod { if (num > MAX_MINT_PER_TX) revert TooManyMintsRequested(); uint256 numRemaining = MAX_NUM_TOKENS - totalSupply; if (num > numRemaining) revert InsufficientTokensRemanining(); if (num * MINT_PRICE != msg.value) revert InvalidPayment(); _processPayment(); _processMint(to, num); } /// @notice Mints the DAO allocated tokens. /// @dev The minter might be different than the receiver. /// @param to Token receiver function mintReserve(address to) external onlyOwner { if (reserveMinted) revert MintDisabled(); reserveMinted = true; _processMint(to, NUM_RESERVED_MINTS); } /// @notice Mints new tokens for the recipient. function _processMint(address to, uint32 num) internal { uint32 supply = totalSupply; for (uint256 i = 0; i < num; i++) { if (MAX_NUM_TOKENS <= supply) revert SoldOut(); ERC721._safeMint(to, supply); supply++; } totalSupply = supply; } // ------------------------------------------------------------------------- // // Signature validataion // // ------------------------------------------------------------------------- /// @notice Removes and adds addresses to the set of allowed signers. /// @dev Removal is performed before addition. function changeSigners( address[] calldata delSigners, address[] calldata addSigners ) external onlyOwner { for (uint256 idx; idx < delSigners.length; ++idx) { _signers.remove(delSigners[idx]); } for (uint256 idx; idx < addSigners.length; ++idx) { _signers.add(addSigners[idx]); } } /// @notice Returns the addresses that are used for signature verification function getSigners() external view returns (address[] memory signers) { uint256 len = _signers.length(); signers = new address[](len); for (uint256 idx = 0; idx < len; ++idx) { signers[idx] = _signers.at(idx); } } // ------------------------------------------------------------------------- // // Payment // // ------------------------------------------------------------------------- /// @notice Default function for receiving funds /// @dev This enables the contract to be used as splitter for royalties. receive() external payable { _processPayment(); } /// @notice Processes an incoming payment and sends it to the payment /// splitter. function _processPayment() internal { paymentSplitter.sendValue(msg.value); } // ------------------------------------------------------------------------- // // Metadata // // ------------------------------------------------------------------------- /// @notice This function is intended to store (genart) code onchain in // calldata. function storeCode(bytes calldata) external { if ( codeStoreLocked || (mintConfig.signedMintOpeningTimestamp > 0 && block.timestamp > mintConfig.signedMintOpeningTimestamp) ) revert CodeStoreLocked(); codeStoreLocked = true; } /// @notice Change tokenURI() base path. /// @param uri The new base path (must not contain trailing slash) function setBaseTokenURI(string calldata uri) external onlyOwner { _baseTokenURI = uri; } /// @notice Returns the URI for token metadata. function tokenURI(uint256 tokenId) public view override tokenExists(tokenId) returns (string memory) { return string( abi.encodePacked( _baseTokenURI, "/", Strings.toString(tokenId), ".json" ) ); } // ------------------------------------------------------------------------- // // Internals // // ------------------------------------------------------------------------- /// @dev See {IERC165-supportsInterface}. function supportsInterface(bytes4 interfaceId) public view virtual override(ERC721Common, ERC2981) returns (bool) { return super.supportsInterface(interfaceId); } // ------------------------------------------------------------------------- // // Errors // // ------------------------------------------------------------------------- error MintDisabled(); error TooManyMintsRequested(); error InsufficientTokensRemanining(); error InvalidPayment(); error SoldOut(); error InvalidSignature(); error ExeedsOwnerAllocation(); error NotAllowedToOwnerMint(); error NotAllowToChangeAddress(); error CodeStoreLocked(); }
// __ __ __ // | \ | \ \ // ______ ______ ____ _______ _| β–“β–“_ __ __ ____| β–“β–“\β–“β–“ ______ // / \| \ \ / \ β–“β–“ \ | \ | \/ β–“β–“ \/ \ // | β–“β–“β–“β–“β–“β–“\ β–“β–“β–“β–“β–“β–“\β–“β–“β–“β–“\ | β–“β–“β–“β–“β–“β–“β–“\β–“β–“β–“β–“β–“β–“ | β–“β–“ | β–“β–“ β–“β–“β–“β–“β–“β–“β–“ β–“β–“ β–“β–“β–“β–“β–“β–“\ // | β–“β–“ | β–“β–“ β–“β–“ | β–“β–“ | β–“β–“ \β–“β–“ \ | β–“β–“ __| β–“β–“ | β–“β–“ β–“β–“ | β–“β–“ β–“β–“ β–“β–“ | β–“β–“ // | β–“β–“__| β–“β–“ β–“β–“ | β–“β–“ | β–“β–“__ _\β–“β–“β–“β–“β–“β–“\ | β–“β–“| \ β–“β–“__/ β–“β–“ β–“β–“__| β–“β–“ β–“β–“ β–“β–“__/ β–“β–“ // \β–“β–“ β–“β–“ β–“β–“ | β–“β–“ | β–“β–“ \ | β–“β–“ \β–“β–“ β–“β–“\β–“β–“ β–“β–“\β–“β–“ β–“β–“ β–“β–“\β–“β–“ β–“β–“ // _\β–“β–“β–“β–“β–“β–“β–“\β–“β–“ \β–“β–“ \β–“β–“\β–“β–“ \β–“β–“β–“β–“β–“β–“β–“ \β–“β–“β–“β–“ \β–“β–“β–“β–“β–“β–“ \β–“β–“β–“β–“β–“β–“β–“\β–“β–“ \β–“β–“β–“β–“β–“β–“ // | \__| β–“β–“ // \β–“β–“ β–“β–“ // \β–“β–“β–“β–“β–“β–“ //
LineComment
_processMint
function _processMint(address to, uint32 num) internal { uint32 supply = totalSupply; for (uint256 i = 0; i < num; i++) { if (MAX_NUM_TOKENS <= supply) revert SoldOut(); ERC721._safeMint(to, supply); supply++; } totalSupply = supply; }
/// @notice Mints new tokens for the recipient.
NatSpecSingleLine
v0.8.11+commit.d7f03943
Unlicense
{ "func_code_index": [ 6455, 6766 ] }
2,102
GmStudioMindTheGap
contracts/collections/MindTheGap/MindTheGap.sol
0x0e42ffbac75bcc30cd0015f8aaa608539ba35fbb
Solidity
GmStudioMindTheGap
contract GmStudioMindTheGap is ERC721Common, ReentrancyGuard, ERC2981SinglePercentual { using EnumerableSet for EnumerableSet.AddressSet; using SignatureChecker for EnumerableSet.AddressSet; using Address for address payable; /// @notice Price for minting uint256 public constant MINT_PRICE = 0.15 ether; /// @notice Splits payments between the Studio and the artist. address payable public immutable paymentSplitter; /// @notice Splits payments between the Studio and the artist. address payable public immutable paymentSplitterRoyalties; /// @notice Total maximum amount of tokens uint32 public constant MAX_NUM_TOKENS = 999; /// @notice Max number of mints per transaction. /// @dev Only for public mints. uint32 public constant MAX_MINT_PER_TX = 1; /// @notice Number of mints throught the signed minting interface. uint32 internal constant NUM_SIGNED_MINTS = 300; /// @notice Number of mints for reserved the studio. uint32 internal constant NUM_RESERVED_MINTS = 1; /// @notice Currently minted supply of tokens uint32 public totalSupply; /// @notice Counter for the remaining signed mints uint32 internal numSignedMintsRemaining; /// @notice Locks the mintReserve function bool internal reserveMinted; /// @notice Locks the code storing function bool internal codeStoreLocked; /// @notice Timestamps to enables/eisables minting interfaces /// @dev The following order is assumed /// signedMintOpeningTimestamp < publicMintOpeningTimestamp < mintClosingTimestamp struct MintConfig { uint64 signedMintOpeningTimestamp; uint64 publicMintOpeningTimestamp; uint64 mintClosingTimestamp; } /// @notice The minting configuration MintConfig public mintConfig; /// @notice Stores the number of tokens minted from a signature /// @dev Used in mintSigned mapping(bytes32 => uint256) public numSignedMintsFrom; /// @notice Signature signers for the early access phase. /// @dev Removing signers invalidates the corresponding signatures. EnumerableSet.AddressSet private _signers; /// @notice tokenURI() base path. /// @dev Without trailing slash string internal _baseTokenURI; constructor( address newOwner, address signer, string memory baseTokenURI, address[] memory payees, uint256[] memory shares, uint256[] memory sharesRoyalties ) ERC721Common("Mind the Gap by MountVitruvius", "MTG") { _signers.add(signer); _baseTokenURI = baseTokenURI; paymentSplitter = payable( PaymentSplitterDeployer.instance().deploy(payees, shares) ); paymentSplitterRoyalties = payable( PaymentSplitterDeployer.instance().deploy(payees, sharesRoyalties) ); _setRoyaltyPercentage(750); _setRoyaltyReceiver(paymentSplitterRoyalties); numSignedMintsRemaining = NUM_SIGNED_MINTS; transferOwnership(newOwner); } // ------------------------------------------------------------------------- // // Minting // // ------------------------------------------------------------------------- /// @notice Toggle minting relevant flags. function setMintConfig(MintConfig calldata config) external onlyOwner { mintConfig = config; } /// @dev Reverts if we are not in the signed minting window or the if /// `mintConfig` has not been set yet. modifier onlyDuringSignedMintingPeriod() { if ( block.timestamp < mintConfig.signedMintOpeningTimestamp || block.timestamp > mintConfig.publicMintOpeningTimestamp ) revert MintDisabled(); _; } /// @dev Reverts if we are not in the public minting window or the if /// `mintConfig` has not been set yet. modifier onlyDuringPublicMintingPeriod() { if ( block.timestamp < mintConfig.publicMintOpeningTimestamp || block.timestamp > mintConfig.mintClosingTimestamp ) revert MintDisabled(); _; } /// @notice Mints tokens to a given address using a signed message. /// @dev The minter might be different than the receiver. /// @param to Token receiver /// @param num Number of tokens to be minted. /// @param numMax Max number of tokens that can be minted to the receiver /// @param signature to prove that the receiver is allowed to get mints. /// @dev The signed messages is generated from `to || numMax`. function mintSigned( address to, uint32 num, uint32 numMax, uint256 nonce, bytes calldata signature ) external payable nonReentrant onlyDuringSignedMintingPeriod { bytes32 message = ECDSA.toEthSignedMessageHash( abi.encodePacked(to, numMax, nonce) ); if (num + numSignedMintsFrom[message] > numMax) revert TooManyMintsRequested(); if (num > numSignedMintsRemaining) revert InsufficientTokensRemanining(); if (num * MINT_PRICE != msg.value) revert InvalidPayment(); _signers.requireValidSignature(message, signature); numSignedMintsFrom[message] += num; numSignedMintsRemaining -= num; _processPayment(); _processMint(to, num); } /// @notice Mints tokens to a given address. /// @dev The minter might be different than the receiver. /// @param to Token receiver /// @param num Number of tokens to be minted. function mintPublic(address to, uint32 num) external payable nonReentrant onlyDuringPublicMintingPeriod { if (num > MAX_MINT_PER_TX) revert TooManyMintsRequested(); uint256 numRemaining = MAX_NUM_TOKENS - totalSupply; if (num > numRemaining) revert InsufficientTokensRemanining(); if (num * MINT_PRICE != msg.value) revert InvalidPayment(); _processPayment(); _processMint(to, num); } /// @notice Mints the DAO allocated tokens. /// @dev The minter might be different than the receiver. /// @param to Token receiver function mintReserve(address to) external onlyOwner { if (reserveMinted) revert MintDisabled(); reserveMinted = true; _processMint(to, NUM_RESERVED_MINTS); } /// @notice Mints new tokens for the recipient. function _processMint(address to, uint32 num) internal { uint32 supply = totalSupply; for (uint256 i = 0; i < num; i++) { if (MAX_NUM_TOKENS <= supply) revert SoldOut(); ERC721._safeMint(to, supply); supply++; } totalSupply = supply; } // ------------------------------------------------------------------------- // // Signature validataion // // ------------------------------------------------------------------------- /// @notice Removes and adds addresses to the set of allowed signers. /// @dev Removal is performed before addition. function changeSigners( address[] calldata delSigners, address[] calldata addSigners ) external onlyOwner { for (uint256 idx; idx < delSigners.length; ++idx) { _signers.remove(delSigners[idx]); } for (uint256 idx; idx < addSigners.length; ++idx) { _signers.add(addSigners[idx]); } } /// @notice Returns the addresses that are used for signature verification function getSigners() external view returns (address[] memory signers) { uint256 len = _signers.length(); signers = new address[](len); for (uint256 idx = 0; idx < len; ++idx) { signers[idx] = _signers.at(idx); } } // ------------------------------------------------------------------------- // // Payment // // ------------------------------------------------------------------------- /// @notice Default function for receiving funds /// @dev This enables the contract to be used as splitter for royalties. receive() external payable { _processPayment(); } /// @notice Processes an incoming payment and sends it to the payment /// splitter. function _processPayment() internal { paymentSplitter.sendValue(msg.value); } // ------------------------------------------------------------------------- // // Metadata // // ------------------------------------------------------------------------- /// @notice This function is intended to store (genart) code onchain in // calldata. function storeCode(bytes calldata) external { if ( codeStoreLocked || (mintConfig.signedMintOpeningTimestamp > 0 && block.timestamp > mintConfig.signedMintOpeningTimestamp) ) revert CodeStoreLocked(); codeStoreLocked = true; } /// @notice Change tokenURI() base path. /// @param uri The new base path (must not contain trailing slash) function setBaseTokenURI(string calldata uri) external onlyOwner { _baseTokenURI = uri; } /// @notice Returns the URI for token metadata. function tokenURI(uint256 tokenId) public view override tokenExists(tokenId) returns (string memory) { return string( abi.encodePacked( _baseTokenURI, "/", Strings.toString(tokenId), ".json" ) ); } // ------------------------------------------------------------------------- // // Internals // // ------------------------------------------------------------------------- /// @dev See {IERC165-supportsInterface}. function supportsInterface(bytes4 interfaceId) public view virtual override(ERC721Common, ERC2981) returns (bool) { return super.supportsInterface(interfaceId); } // ------------------------------------------------------------------------- // // Errors // // ------------------------------------------------------------------------- error MintDisabled(); error TooManyMintsRequested(); error InsufficientTokensRemanining(); error InvalidPayment(); error SoldOut(); error InvalidSignature(); error ExeedsOwnerAllocation(); error NotAllowedToOwnerMint(); error NotAllowToChangeAddress(); error CodeStoreLocked(); }
// __ __ __ // | \ | \ \ // ______ ______ ____ _______ _| β–“β–“_ __ __ ____| β–“β–“\β–“β–“ ______ // / \| \ \ / \ β–“β–“ \ | \ | \/ β–“β–“ \/ \ // | β–“β–“β–“β–“β–“β–“\ β–“β–“β–“β–“β–“β–“\β–“β–“β–“β–“\ | β–“β–“β–“β–“β–“β–“β–“\β–“β–“β–“β–“β–“β–“ | β–“β–“ | β–“β–“ β–“β–“β–“β–“β–“β–“β–“ β–“β–“ β–“β–“β–“β–“β–“β–“\ // | β–“β–“ | β–“β–“ β–“β–“ | β–“β–“ | β–“β–“ \β–“β–“ \ | β–“β–“ __| β–“β–“ | β–“β–“ β–“β–“ | β–“β–“ β–“β–“ β–“β–“ | β–“β–“ // | β–“β–“__| β–“β–“ β–“β–“ | β–“β–“ | β–“β–“__ _\β–“β–“β–“β–“β–“β–“\ | β–“β–“| \ β–“β–“__/ β–“β–“ β–“β–“__| β–“β–“ β–“β–“ β–“β–“__/ β–“β–“ // \β–“β–“ β–“β–“ β–“β–“ | β–“β–“ | β–“β–“ \ | β–“β–“ \β–“β–“ β–“β–“\β–“β–“ β–“β–“\β–“β–“ β–“β–“ β–“β–“\β–“β–“ β–“β–“ // _\β–“β–“β–“β–“β–“β–“β–“\β–“β–“ \β–“β–“ \β–“β–“\β–“β–“ \β–“β–“β–“β–“β–“β–“β–“ \β–“β–“β–“β–“ \β–“β–“β–“β–“β–“β–“ \β–“β–“β–“β–“β–“β–“β–“\β–“β–“ \β–“β–“β–“β–“β–“β–“ // | \__| β–“β–“ // \β–“β–“ β–“β–“ // \β–“β–“β–“β–“β–“β–“ //
LineComment
changeSigners
function changeSigners( address[] calldata delSigners, address[] calldata addSigners ) external onlyOwner { for (uint256 idx; idx < delSigners.length; ++idx) { _signers.remove(delSigners[idx]); } for (uint256 idx; idx < addSigners.length; ++idx) { _signers.add(addSigners[idx]); } }
/// @notice Removes and adds addresses to the set of allowed signers. /// @dev Removal is performed before addition.
NatSpecSingleLine
v0.8.11+commit.d7f03943
Unlicense
{ "func_code_index": [ 7100, 7466 ] }
2,103
GmStudioMindTheGap
contracts/collections/MindTheGap/MindTheGap.sol
0x0e42ffbac75bcc30cd0015f8aaa608539ba35fbb
Solidity
GmStudioMindTheGap
contract GmStudioMindTheGap is ERC721Common, ReentrancyGuard, ERC2981SinglePercentual { using EnumerableSet for EnumerableSet.AddressSet; using SignatureChecker for EnumerableSet.AddressSet; using Address for address payable; /// @notice Price for minting uint256 public constant MINT_PRICE = 0.15 ether; /// @notice Splits payments between the Studio and the artist. address payable public immutable paymentSplitter; /// @notice Splits payments between the Studio and the artist. address payable public immutable paymentSplitterRoyalties; /// @notice Total maximum amount of tokens uint32 public constant MAX_NUM_TOKENS = 999; /// @notice Max number of mints per transaction. /// @dev Only for public mints. uint32 public constant MAX_MINT_PER_TX = 1; /// @notice Number of mints throught the signed minting interface. uint32 internal constant NUM_SIGNED_MINTS = 300; /// @notice Number of mints for reserved the studio. uint32 internal constant NUM_RESERVED_MINTS = 1; /// @notice Currently minted supply of tokens uint32 public totalSupply; /// @notice Counter for the remaining signed mints uint32 internal numSignedMintsRemaining; /// @notice Locks the mintReserve function bool internal reserveMinted; /// @notice Locks the code storing function bool internal codeStoreLocked; /// @notice Timestamps to enables/eisables minting interfaces /// @dev The following order is assumed /// signedMintOpeningTimestamp < publicMintOpeningTimestamp < mintClosingTimestamp struct MintConfig { uint64 signedMintOpeningTimestamp; uint64 publicMintOpeningTimestamp; uint64 mintClosingTimestamp; } /// @notice The minting configuration MintConfig public mintConfig; /// @notice Stores the number of tokens minted from a signature /// @dev Used in mintSigned mapping(bytes32 => uint256) public numSignedMintsFrom; /// @notice Signature signers for the early access phase. /// @dev Removing signers invalidates the corresponding signatures. EnumerableSet.AddressSet private _signers; /// @notice tokenURI() base path. /// @dev Without trailing slash string internal _baseTokenURI; constructor( address newOwner, address signer, string memory baseTokenURI, address[] memory payees, uint256[] memory shares, uint256[] memory sharesRoyalties ) ERC721Common("Mind the Gap by MountVitruvius", "MTG") { _signers.add(signer); _baseTokenURI = baseTokenURI; paymentSplitter = payable( PaymentSplitterDeployer.instance().deploy(payees, shares) ); paymentSplitterRoyalties = payable( PaymentSplitterDeployer.instance().deploy(payees, sharesRoyalties) ); _setRoyaltyPercentage(750); _setRoyaltyReceiver(paymentSplitterRoyalties); numSignedMintsRemaining = NUM_SIGNED_MINTS; transferOwnership(newOwner); } // ------------------------------------------------------------------------- // // Minting // // ------------------------------------------------------------------------- /// @notice Toggle minting relevant flags. function setMintConfig(MintConfig calldata config) external onlyOwner { mintConfig = config; } /// @dev Reverts if we are not in the signed minting window or the if /// `mintConfig` has not been set yet. modifier onlyDuringSignedMintingPeriod() { if ( block.timestamp < mintConfig.signedMintOpeningTimestamp || block.timestamp > mintConfig.publicMintOpeningTimestamp ) revert MintDisabled(); _; } /// @dev Reverts if we are not in the public minting window or the if /// `mintConfig` has not been set yet. modifier onlyDuringPublicMintingPeriod() { if ( block.timestamp < mintConfig.publicMintOpeningTimestamp || block.timestamp > mintConfig.mintClosingTimestamp ) revert MintDisabled(); _; } /// @notice Mints tokens to a given address using a signed message. /// @dev The minter might be different than the receiver. /// @param to Token receiver /// @param num Number of tokens to be minted. /// @param numMax Max number of tokens that can be minted to the receiver /// @param signature to prove that the receiver is allowed to get mints. /// @dev The signed messages is generated from `to || numMax`. function mintSigned( address to, uint32 num, uint32 numMax, uint256 nonce, bytes calldata signature ) external payable nonReentrant onlyDuringSignedMintingPeriod { bytes32 message = ECDSA.toEthSignedMessageHash( abi.encodePacked(to, numMax, nonce) ); if (num + numSignedMintsFrom[message] > numMax) revert TooManyMintsRequested(); if (num > numSignedMintsRemaining) revert InsufficientTokensRemanining(); if (num * MINT_PRICE != msg.value) revert InvalidPayment(); _signers.requireValidSignature(message, signature); numSignedMintsFrom[message] += num; numSignedMintsRemaining -= num; _processPayment(); _processMint(to, num); } /// @notice Mints tokens to a given address. /// @dev The minter might be different than the receiver. /// @param to Token receiver /// @param num Number of tokens to be minted. function mintPublic(address to, uint32 num) external payable nonReentrant onlyDuringPublicMintingPeriod { if (num > MAX_MINT_PER_TX) revert TooManyMintsRequested(); uint256 numRemaining = MAX_NUM_TOKENS - totalSupply; if (num > numRemaining) revert InsufficientTokensRemanining(); if (num * MINT_PRICE != msg.value) revert InvalidPayment(); _processPayment(); _processMint(to, num); } /// @notice Mints the DAO allocated tokens. /// @dev The minter might be different than the receiver. /// @param to Token receiver function mintReserve(address to) external onlyOwner { if (reserveMinted) revert MintDisabled(); reserveMinted = true; _processMint(to, NUM_RESERVED_MINTS); } /// @notice Mints new tokens for the recipient. function _processMint(address to, uint32 num) internal { uint32 supply = totalSupply; for (uint256 i = 0; i < num; i++) { if (MAX_NUM_TOKENS <= supply) revert SoldOut(); ERC721._safeMint(to, supply); supply++; } totalSupply = supply; } // ------------------------------------------------------------------------- // // Signature validataion // // ------------------------------------------------------------------------- /// @notice Removes and adds addresses to the set of allowed signers. /// @dev Removal is performed before addition. function changeSigners( address[] calldata delSigners, address[] calldata addSigners ) external onlyOwner { for (uint256 idx; idx < delSigners.length; ++idx) { _signers.remove(delSigners[idx]); } for (uint256 idx; idx < addSigners.length; ++idx) { _signers.add(addSigners[idx]); } } /// @notice Returns the addresses that are used for signature verification function getSigners() external view returns (address[] memory signers) { uint256 len = _signers.length(); signers = new address[](len); for (uint256 idx = 0; idx < len; ++idx) { signers[idx] = _signers.at(idx); } } // ------------------------------------------------------------------------- // // Payment // // ------------------------------------------------------------------------- /// @notice Default function for receiving funds /// @dev This enables the contract to be used as splitter for royalties. receive() external payable { _processPayment(); } /// @notice Processes an incoming payment and sends it to the payment /// splitter. function _processPayment() internal { paymentSplitter.sendValue(msg.value); } // ------------------------------------------------------------------------- // // Metadata // // ------------------------------------------------------------------------- /// @notice This function is intended to store (genart) code onchain in // calldata. function storeCode(bytes calldata) external { if ( codeStoreLocked || (mintConfig.signedMintOpeningTimestamp > 0 && block.timestamp > mintConfig.signedMintOpeningTimestamp) ) revert CodeStoreLocked(); codeStoreLocked = true; } /// @notice Change tokenURI() base path. /// @param uri The new base path (must not contain trailing slash) function setBaseTokenURI(string calldata uri) external onlyOwner { _baseTokenURI = uri; } /// @notice Returns the URI for token metadata. function tokenURI(uint256 tokenId) public view override tokenExists(tokenId) returns (string memory) { return string( abi.encodePacked( _baseTokenURI, "/", Strings.toString(tokenId), ".json" ) ); } // ------------------------------------------------------------------------- // // Internals // // ------------------------------------------------------------------------- /// @dev See {IERC165-supportsInterface}. function supportsInterface(bytes4 interfaceId) public view virtual override(ERC721Common, ERC2981) returns (bool) { return super.supportsInterface(interfaceId); } // ------------------------------------------------------------------------- // // Errors // // ------------------------------------------------------------------------- error MintDisabled(); error TooManyMintsRequested(); error InsufficientTokensRemanining(); error InvalidPayment(); error SoldOut(); error InvalidSignature(); error ExeedsOwnerAllocation(); error NotAllowedToOwnerMint(); error NotAllowToChangeAddress(); error CodeStoreLocked(); }
// __ __ __ // | \ | \ \ // ______ ______ ____ _______ _| β–“β–“_ __ __ ____| β–“β–“\β–“β–“ ______ // / \| \ \ / \ β–“β–“ \ | \ | \/ β–“β–“ \/ \ // | β–“β–“β–“β–“β–“β–“\ β–“β–“β–“β–“β–“β–“\β–“β–“β–“β–“\ | β–“β–“β–“β–“β–“β–“β–“\β–“β–“β–“β–“β–“β–“ | β–“β–“ | β–“β–“ β–“β–“β–“β–“β–“β–“β–“ β–“β–“ β–“β–“β–“β–“β–“β–“\ // | β–“β–“ | β–“β–“ β–“β–“ | β–“β–“ | β–“β–“ \β–“β–“ \ | β–“β–“ __| β–“β–“ | β–“β–“ β–“β–“ | β–“β–“ β–“β–“ β–“β–“ | β–“β–“ // | β–“β–“__| β–“β–“ β–“β–“ | β–“β–“ | β–“β–“__ _\β–“β–“β–“β–“β–“β–“\ | β–“β–“| \ β–“β–“__/ β–“β–“ β–“β–“__| β–“β–“ β–“β–“ β–“β–“__/ β–“β–“ // \β–“β–“ β–“β–“ β–“β–“ | β–“β–“ | β–“β–“ \ | β–“β–“ \β–“β–“ β–“β–“\β–“β–“ β–“β–“\β–“β–“ β–“β–“ β–“β–“\β–“β–“ β–“β–“ // _\β–“β–“β–“β–“β–“β–“β–“\β–“β–“ \β–“β–“ \β–“β–“\β–“β–“ \β–“β–“β–“β–“β–“β–“β–“ \β–“β–“β–“β–“ \β–“β–“β–“β–“β–“β–“ \β–“β–“β–“β–“β–“β–“β–“\β–“β–“ \β–“β–“β–“β–“β–“β–“ // | \__| β–“β–“ // \β–“β–“ β–“β–“ // \β–“β–“β–“β–“β–“β–“ //
LineComment
getSigners
function getSigners() external view returns (address[] memory signers) { uint256 len = _signers.length(); signers = new address[](len); for (uint256 idx = 0; idx < len; ++idx) { signers[idx] = _signers.at(idx); } }
/// @notice Returns the addresses that are used for signature verification
NatSpecSingleLine
v0.8.11+commit.d7f03943
Unlicense
{ "func_code_index": [ 7547, 7813 ] }
2,104
GmStudioMindTheGap
contracts/collections/MindTheGap/MindTheGap.sol
0x0e42ffbac75bcc30cd0015f8aaa608539ba35fbb
Solidity
GmStudioMindTheGap
contract GmStudioMindTheGap is ERC721Common, ReentrancyGuard, ERC2981SinglePercentual { using EnumerableSet for EnumerableSet.AddressSet; using SignatureChecker for EnumerableSet.AddressSet; using Address for address payable; /// @notice Price for minting uint256 public constant MINT_PRICE = 0.15 ether; /// @notice Splits payments between the Studio and the artist. address payable public immutable paymentSplitter; /// @notice Splits payments between the Studio and the artist. address payable public immutable paymentSplitterRoyalties; /// @notice Total maximum amount of tokens uint32 public constant MAX_NUM_TOKENS = 999; /// @notice Max number of mints per transaction. /// @dev Only for public mints. uint32 public constant MAX_MINT_PER_TX = 1; /// @notice Number of mints throught the signed minting interface. uint32 internal constant NUM_SIGNED_MINTS = 300; /// @notice Number of mints for reserved the studio. uint32 internal constant NUM_RESERVED_MINTS = 1; /// @notice Currently minted supply of tokens uint32 public totalSupply; /// @notice Counter for the remaining signed mints uint32 internal numSignedMintsRemaining; /// @notice Locks the mintReserve function bool internal reserveMinted; /// @notice Locks the code storing function bool internal codeStoreLocked; /// @notice Timestamps to enables/eisables minting interfaces /// @dev The following order is assumed /// signedMintOpeningTimestamp < publicMintOpeningTimestamp < mintClosingTimestamp struct MintConfig { uint64 signedMintOpeningTimestamp; uint64 publicMintOpeningTimestamp; uint64 mintClosingTimestamp; } /// @notice The minting configuration MintConfig public mintConfig; /// @notice Stores the number of tokens minted from a signature /// @dev Used in mintSigned mapping(bytes32 => uint256) public numSignedMintsFrom; /// @notice Signature signers for the early access phase. /// @dev Removing signers invalidates the corresponding signatures. EnumerableSet.AddressSet private _signers; /// @notice tokenURI() base path. /// @dev Without trailing slash string internal _baseTokenURI; constructor( address newOwner, address signer, string memory baseTokenURI, address[] memory payees, uint256[] memory shares, uint256[] memory sharesRoyalties ) ERC721Common("Mind the Gap by MountVitruvius", "MTG") { _signers.add(signer); _baseTokenURI = baseTokenURI; paymentSplitter = payable( PaymentSplitterDeployer.instance().deploy(payees, shares) ); paymentSplitterRoyalties = payable( PaymentSplitterDeployer.instance().deploy(payees, sharesRoyalties) ); _setRoyaltyPercentage(750); _setRoyaltyReceiver(paymentSplitterRoyalties); numSignedMintsRemaining = NUM_SIGNED_MINTS; transferOwnership(newOwner); } // ------------------------------------------------------------------------- // // Minting // // ------------------------------------------------------------------------- /// @notice Toggle minting relevant flags. function setMintConfig(MintConfig calldata config) external onlyOwner { mintConfig = config; } /// @dev Reverts if we are not in the signed minting window or the if /// `mintConfig` has not been set yet. modifier onlyDuringSignedMintingPeriod() { if ( block.timestamp < mintConfig.signedMintOpeningTimestamp || block.timestamp > mintConfig.publicMintOpeningTimestamp ) revert MintDisabled(); _; } /// @dev Reverts if we are not in the public minting window or the if /// `mintConfig` has not been set yet. modifier onlyDuringPublicMintingPeriod() { if ( block.timestamp < mintConfig.publicMintOpeningTimestamp || block.timestamp > mintConfig.mintClosingTimestamp ) revert MintDisabled(); _; } /// @notice Mints tokens to a given address using a signed message. /// @dev The minter might be different than the receiver. /// @param to Token receiver /// @param num Number of tokens to be minted. /// @param numMax Max number of tokens that can be minted to the receiver /// @param signature to prove that the receiver is allowed to get mints. /// @dev The signed messages is generated from `to || numMax`. function mintSigned( address to, uint32 num, uint32 numMax, uint256 nonce, bytes calldata signature ) external payable nonReentrant onlyDuringSignedMintingPeriod { bytes32 message = ECDSA.toEthSignedMessageHash( abi.encodePacked(to, numMax, nonce) ); if (num + numSignedMintsFrom[message] > numMax) revert TooManyMintsRequested(); if (num > numSignedMintsRemaining) revert InsufficientTokensRemanining(); if (num * MINT_PRICE != msg.value) revert InvalidPayment(); _signers.requireValidSignature(message, signature); numSignedMintsFrom[message] += num; numSignedMintsRemaining -= num; _processPayment(); _processMint(to, num); } /// @notice Mints tokens to a given address. /// @dev The minter might be different than the receiver. /// @param to Token receiver /// @param num Number of tokens to be minted. function mintPublic(address to, uint32 num) external payable nonReentrant onlyDuringPublicMintingPeriod { if (num > MAX_MINT_PER_TX) revert TooManyMintsRequested(); uint256 numRemaining = MAX_NUM_TOKENS - totalSupply; if (num > numRemaining) revert InsufficientTokensRemanining(); if (num * MINT_PRICE != msg.value) revert InvalidPayment(); _processPayment(); _processMint(to, num); } /// @notice Mints the DAO allocated tokens. /// @dev The minter might be different than the receiver. /// @param to Token receiver function mintReserve(address to) external onlyOwner { if (reserveMinted) revert MintDisabled(); reserveMinted = true; _processMint(to, NUM_RESERVED_MINTS); } /// @notice Mints new tokens for the recipient. function _processMint(address to, uint32 num) internal { uint32 supply = totalSupply; for (uint256 i = 0; i < num; i++) { if (MAX_NUM_TOKENS <= supply) revert SoldOut(); ERC721._safeMint(to, supply); supply++; } totalSupply = supply; } // ------------------------------------------------------------------------- // // Signature validataion // // ------------------------------------------------------------------------- /// @notice Removes and adds addresses to the set of allowed signers. /// @dev Removal is performed before addition. function changeSigners( address[] calldata delSigners, address[] calldata addSigners ) external onlyOwner { for (uint256 idx; idx < delSigners.length; ++idx) { _signers.remove(delSigners[idx]); } for (uint256 idx; idx < addSigners.length; ++idx) { _signers.add(addSigners[idx]); } } /// @notice Returns the addresses that are used for signature verification function getSigners() external view returns (address[] memory signers) { uint256 len = _signers.length(); signers = new address[](len); for (uint256 idx = 0; idx < len; ++idx) { signers[idx] = _signers.at(idx); } } // ------------------------------------------------------------------------- // // Payment // // ------------------------------------------------------------------------- /// @notice Default function for receiving funds /// @dev This enables the contract to be used as splitter for royalties. receive() external payable { _processPayment(); } /// @notice Processes an incoming payment and sends it to the payment /// splitter. function _processPayment() internal { paymentSplitter.sendValue(msg.value); } // ------------------------------------------------------------------------- // // Metadata // // ------------------------------------------------------------------------- /// @notice This function is intended to store (genart) code onchain in // calldata. function storeCode(bytes calldata) external { if ( codeStoreLocked || (mintConfig.signedMintOpeningTimestamp > 0 && block.timestamp > mintConfig.signedMintOpeningTimestamp) ) revert CodeStoreLocked(); codeStoreLocked = true; } /// @notice Change tokenURI() base path. /// @param uri The new base path (must not contain trailing slash) function setBaseTokenURI(string calldata uri) external onlyOwner { _baseTokenURI = uri; } /// @notice Returns the URI for token metadata. function tokenURI(uint256 tokenId) public view override tokenExists(tokenId) returns (string memory) { return string( abi.encodePacked( _baseTokenURI, "/", Strings.toString(tokenId), ".json" ) ); } // ------------------------------------------------------------------------- // // Internals // // ------------------------------------------------------------------------- /// @dev See {IERC165-supportsInterface}. function supportsInterface(bytes4 interfaceId) public view virtual override(ERC721Common, ERC2981) returns (bool) { return super.supportsInterface(interfaceId); } // ------------------------------------------------------------------------- // // Errors // // ------------------------------------------------------------------------- error MintDisabled(); error TooManyMintsRequested(); error InsufficientTokensRemanining(); error InvalidPayment(); error SoldOut(); error InvalidSignature(); error ExeedsOwnerAllocation(); error NotAllowedToOwnerMint(); error NotAllowToChangeAddress(); error CodeStoreLocked(); }
// __ __ __ // | \ | \ \ // ______ ______ ____ _______ _| β–“β–“_ __ __ ____| β–“β–“\β–“β–“ ______ // / \| \ \ / \ β–“β–“ \ | \ | \/ β–“β–“ \/ \ // | β–“β–“β–“β–“β–“β–“\ β–“β–“β–“β–“β–“β–“\β–“β–“β–“β–“\ | β–“β–“β–“β–“β–“β–“β–“\β–“β–“β–“β–“β–“β–“ | β–“β–“ | β–“β–“ β–“β–“β–“β–“β–“β–“β–“ β–“β–“ β–“β–“β–“β–“β–“β–“\ // | β–“β–“ | β–“β–“ β–“β–“ | β–“β–“ | β–“β–“ \β–“β–“ \ | β–“β–“ __| β–“β–“ | β–“β–“ β–“β–“ | β–“β–“ β–“β–“ β–“β–“ | β–“β–“ // | β–“β–“__| β–“β–“ β–“β–“ | β–“β–“ | β–“β–“__ _\β–“β–“β–“β–“β–“β–“\ | β–“β–“| \ β–“β–“__/ β–“β–“ β–“β–“__| β–“β–“ β–“β–“ β–“β–“__/ β–“β–“ // \β–“β–“ β–“β–“ β–“β–“ | β–“β–“ | β–“β–“ \ | β–“β–“ \β–“β–“ β–“β–“\β–“β–“ β–“β–“\β–“β–“ β–“β–“ β–“β–“\β–“β–“ β–“β–“ // _\β–“β–“β–“β–“β–“β–“β–“\β–“β–“ \β–“β–“ \β–“β–“\β–“β–“ \β–“β–“β–“β–“β–“β–“β–“ \β–“β–“β–“β–“ \β–“β–“β–“β–“β–“β–“ \β–“β–“β–“β–“β–“β–“β–“\β–“β–“ \β–“β–“β–“β–“β–“β–“ // | \__| β–“β–“ // \β–“β–“ β–“β–“ // \β–“β–“β–“β–“β–“β–“ //
LineComment
/// @notice Default function for receiving funds /// @dev This enables the contract to be used as splitter for royalties.
NatSpecSingleLine
v0.8.11+commit.d7f03943
Unlicense
{ "func_code_index": [ 8138, 8203 ] }
2,105
GmStudioMindTheGap
contracts/collections/MindTheGap/MindTheGap.sol
0x0e42ffbac75bcc30cd0015f8aaa608539ba35fbb
Solidity
GmStudioMindTheGap
contract GmStudioMindTheGap is ERC721Common, ReentrancyGuard, ERC2981SinglePercentual { using EnumerableSet for EnumerableSet.AddressSet; using SignatureChecker for EnumerableSet.AddressSet; using Address for address payable; /// @notice Price for minting uint256 public constant MINT_PRICE = 0.15 ether; /// @notice Splits payments between the Studio and the artist. address payable public immutable paymentSplitter; /// @notice Splits payments between the Studio and the artist. address payable public immutable paymentSplitterRoyalties; /// @notice Total maximum amount of tokens uint32 public constant MAX_NUM_TOKENS = 999; /// @notice Max number of mints per transaction. /// @dev Only for public mints. uint32 public constant MAX_MINT_PER_TX = 1; /// @notice Number of mints throught the signed minting interface. uint32 internal constant NUM_SIGNED_MINTS = 300; /// @notice Number of mints for reserved the studio. uint32 internal constant NUM_RESERVED_MINTS = 1; /// @notice Currently minted supply of tokens uint32 public totalSupply; /// @notice Counter for the remaining signed mints uint32 internal numSignedMintsRemaining; /// @notice Locks the mintReserve function bool internal reserveMinted; /// @notice Locks the code storing function bool internal codeStoreLocked; /// @notice Timestamps to enables/eisables minting interfaces /// @dev The following order is assumed /// signedMintOpeningTimestamp < publicMintOpeningTimestamp < mintClosingTimestamp struct MintConfig { uint64 signedMintOpeningTimestamp; uint64 publicMintOpeningTimestamp; uint64 mintClosingTimestamp; } /// @notice The minting configuration MintConfig public mintConfig; /// @notice Stores the number of tokens minted from a signature /// @dev Used in mintSigned mapping(bytes32 => uint256) public numSignedMintsFrom; /// @notice Signature signers for the early access phase. /// @dev Removing signers invalidates the corresponding signatures. EnumerableSet.AddressSet private _signers; /// @notice tokenURI() base path. /// @dev Without trailing slash string internal _baseTokenURI; constructor( address newOwner, address signer, string memory baseTokenURI, address[] memory payees, uint256[] memory shares, uint256[] memory sharesRoyalties ) ERC721Common("Mind the Gap by MountVitruvius", "MTG") { _signers.add(signer); _baseTokenURI = baseTokenURI; paymentSplitter = payable( PaymentSplitterDeployer.instance().deploy(payees, shares) ); paymentSplitterRoyalties = payable( PaymentSplitterDeployer.instance().deploy(payees, sharesRoyalties) ); _setRoyaltyPercentage(750); _setRoyaltyReceiver(paymentSplitterRoyalties); numSignedMintsRemaining = NUM_SIGNED_MINTS; transferOwnership(newOwner); } // ------------------------------------------------------------------------- // // Minting // // ------------------------------------------------------------------------- /// @notice Toggle minting relevant flags. function setMintConfig(MintConfig calldata config) external onlyOwner { mintConfig = config; } /// @dev Reverts if we are not in the signed minting window or the if /// `mintConfig` has not been set yet. modifier onlyDuringSignedMintingPeriod() { if ( block.timestamp < mintConfig.signedMintOpeningTimestamp || block.timestamp > mintConfig.publicMintOpeningTimestamp ) revert MintDisabled(); _; } /// @dev Reverts if we are not in the public minting window or the if /// `mintConfig` has not been set yet. modifier onlyDuringPublicMintingPeriod() { if ( block.timestamp < mintConfig.publicMintOpeningTimestamp || block.timestamp > mintConfig.mintClosingTimestamp ) revert MintDisabled(); _; } /// @notice Mints tokens to a given address using a signed message. /// @dev The minter might be different than the receiver. /// @param to Token receiver /// @param num Number of tokens to be minted. /// @param numMax Max number of tokens that can be minted to the receiver /// @param signature to prove that the receiver is allowed to get mints. /// @dev The signed messages is generated from `to || numMax`. function mintSigned( address to, uint32 num, uint32 numMax, uint256 nonce, bytes calldata signature ) external payable nonReentrant onlyDuringSignedMintingPeriod { bytes32 message = ECDSA.toEthSignedMessageHash( abi.encodePacked(to, numMax, nonce) ); if (num + numSignedMintsFrom[message] > numMax) revert TooManyMintsRequested(); if (num > numSignedMintsRemaining) revert InsufficientTokensRemanining(); if (num * MINT_PRICE != msg.value) revert InvalidPayment(); _signers.requireValidSignature(message, signature); numSignedMintsFrom[message] += num; numSignedMintsRemaining -= num; _processPayment(); _processMint(to, num); } /// @notice Mints tokens to a given address. /// @dev The minter might be different than the receiver. /// @param to Token receiver /// @param num Number of tokens to be minted. function mintPublic(address to, uint32 num) external payable nonReentrant onlyDuringPublicMintingPeriod { if (num > MAX_MINT_PER_TX) revert TooManyMintsRequested(); uint256 numRemaining = MAX_NUM_TOKENS - totalSupply; if (num > numRemaining) revert InsufficientTokensRemanining(); if (num * MINT_PRICE != msg.value) revert InvalidPayment(); _processPayment(); _processMint(to, num); } /// @notice Mints the DAO allocated tokens. /// @dev The minter might be different than the receiver. /// @param to Token receiver function mintReserve(address to) external onlyOwner { if (reserveMinted) revert MintDisabled(); reserveMinted = true; _processMint(to, NUM_RESERVED_MINTS); } /// @notice Mints new tokens for the recipient. function _processMint(address to, uint32 num) internal { uint32 supply = totalSupply; for (uint256 i = 0; i < num; i++) { if (MAX_NUM_TOKENS <= supply) revert SoldOut(); ERC721._safeMint(to, supply); supply++; } totalSupply = supply; } // ------------------------------------------------------------------------- // // Signature validataion // // ------------------------------------------------------------------------- /// @notice Removes and adds addresses to the set of allowed signers. /// @dev Removal is performed before addition. function changeSigners( address[] calldata delSigners, address[] calldata addSigners ) external onlyOwner { for (uint256 idx; idx < delSigners.length; ++idx) { _signers.remove(delSigners[idx]); } for (uint256 idx; idx < addSigners.length; ++idx) { _signers.add(addSigners[idx]); } } /// @notice Returns the addresses that are used for signature verification function getSigners() external view returns (address[] memory signers) { uint256 len = _signers.length(); signers = new address[](len); for (uint256 idx = 0; idx < len; ++idx) { signers[idx] = _signers.at(idx); } } // ------------------------------------------------------------------------- // // Payment // // ------------------------------------------------------------------------- /// @notice Default function for receiving funds /// @dev This enables the contract to be used as splitter for royalties. receive() external payable { _processPayment(); } /// @notice Processes an incoming payment and sends it to the payment /// splitter. function _processPayment() internal { paymentSplitter.sendValue(msg.value); } // ------------------------------------------------------------------------- // // Metadata // // ------------------------------------------------------------------------- /// @notice This function is intended to store (genart) code onchain in // calldata. function storeCode(bytes calldata) external { if ( codeStoreLocked || (mintConfig.signedMintOpeningTimestamp > 0 && block.timestamp > mintConfig.signedMintOpeningTimestamp) ) revert CodeStoreLocked(); codeStoreLocked = true; } /// @notice Change tokenURI() base path. /// @param uri The new base path (must not contain trailing slash) function setBaseTokenURI(string calldata uri) external onlyOwner { _baseTokenURI = uri; } /// @notice Returns the URI for token metadata. function tokenURI(uint256 tokenId) public view override tokenExists(tokenId) returns (string memory) { return string( abi.encodePacked( _baseTokenURI, "/", Strings.toString(tokenId), ".json" ) ); } // ------------------------------------------------------------------------- // // Internals // // ------------------------------------------------------------------------- /// @dev See {IERC165-supportsInterface}. function supportsInterface(bytes4 interfaceId) public view virtual override(ERC721Common, ERC2981) returns (bool) { return super.supportsInterface(interfaceId); } // ------------------------------------------------------------------------- // // Errors // // ------------------------------------------------------------------------- error MintDisabled(); error TooManyMintsRequested(); error InsufficientTokensRemanining(); error InvalidPayment(); error SoldOut(); error InvalidSignature(); error ExeedsOwnerAllocation(); error NotAllowedToOwnerMint(); error NotAllowToChangeAddress(); error CodeStoreLocked(); }
// __ __ __ // | \ | \ \ // ______ ______ ____ _______ _| β–“β–“_ __ __ ____| β–“β–“\β–“β–“ ______ // / \| \ \ / \ β–“β–“ \ | \ | \/ β–“β–“ \/ \ // | β–“β–“β–“β–“β–“β–“\ β–“β–“β–“β–“β–“β–“\β–“β–“β–“β–“\ | β–“β–“β–“β–“β–“β–“β–“\β–“β–“β–“β–“β–“β–“ | β–“β–“ | β–“β–“ β–“β–“β–“β–“β–“β–“β–“ β–“β–“ β–“β–“β–“β–“β–“β–“\ // | β–“β–“ | β–“β–“ β–“β–“ | β–“β–“ | β–“β–“ \β–“β–“ \ | β–“β–“ __| β–“β–“ | β–“β–“ β–“β–“ | β–“β–“ β–“β–“ β–“β–“ | β–“β–“ // | β–“β–“__| β–“β–“ β–“β–“ | β–“β–“ | β–“β–“__ _\β–“β–“β–“β–“β–“β–“\ | β–“β–“| \ β–“β–“__/ β–“β–“ β–“β–“__| β–“β–“ β–“β–“ β–“β–“__/ β–“β–“ // \β–“β–“ β–“β–“ β–“β–“ | β–“β–“ | β–“β–“ \ | β–“β–“ \β–“β–“ β–“β–“\β–“β–“ β–“β–“\β–“β–“ β–“β–“ β–“β–“\β–“β–“ β–“β–“ // _\β–“β–“β–“β–“β–“β–“β–“\β–“β–“ \β–“β–“ \β–“β–“\β–“β–“ \β–“β–“β–“β–“β–“β–“β–“ \β–“β–“β–“β–“ \β–“β–“β–“β–“β–“β–“ \β–“β–“β–“β–“β–“β–“β–“\β–“β–“ \β–“β–“β–“β–“β–“β–“ // | \__| β–“β–“ // \β–“β–“ β–“β–“ // \β–“β–“β–“β–“β–“β–“ //
LineComment
_processPayment
function _processPayment() internal { paymentSplitter.sendValue(msg.value); }
/// @notice Processes an incoming payment and sends it to the payment /// splitter.
NatSpecSingleLine
v0.8.11+commit.d7f03943
Unlicense
{ "func_code_index": [ 8297, 8390 ] }
2,106