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
Bridge
contracts/Bridge.sol
0x27ef066f3a3758ff8ee0cf5b86c7dbc0348f77e2
Solidity
Bridge
contract Bridge is IBridgeV1, Ownable { using SafeMath for uint256; // token for the bridge address public token; // List of TXs from the other chain that were processed mapping (bytes32 => bool) txHashes; // Current Fee Rate uint public fee = 5 * 1e18; constructor(address _tokenAddress) { token = _tokenAddress; } /** * @dev Initiates a token transfer from the given ledger to another Ethereum-compliant ledger. * @param amount The amount of tokens getting locked and swapped from the ledger * @param swapInAddress The address (on another ledger) to which the tokens are swapped */ function SwapOut(uint256 amount, address swapInAddress) external override returns (bool) { require(swapInAddress != address(0), "Bridge: swapInAddress"); require(amount > 0, "Bridge: amount"); require( IERC20(token).transferFrom(msg.sender, address(this), amount), "Bridge: transfer" ); emit LogSwapOut(msg.sender, swapInAddress, amount); return true; } /** * @dev Initiates a token transfer from the given ledger to another Ethereum-compliant ledger. * @param txHash Transaction hash on the ledger where the swap has beed initiated. * @param to The address to which the tokens are swapped * @param amount The amount of tokens released */ function SwapIn( bytes32 txHash, address to, uint256 amount ) external override onlyOwner returns (bool) { require (txHash != bytes32(0), "Bridge: invalid tx"); require (to != address(0), "Bridge: invalid addr"); require (txHashes[txHash] == false, "Bridge: dup tx"); txHashes[txHash] = true; require( IERC20(token).transfer(to, amount.sub(fee, "Bridge: invalid amount")), // automatically checks for amount > fee otherwise throw safemath "Bridge: transfer" ); emit LogSwapIn(txHash, to, amount.sub(fee), fee); return true; } /** * @dev Initiates a withdrawal transfer from the bridge contract to an address. Only call-able by the owner * @param to The address to which the tokens are swapped * @param amount The amount of tokens released */ function withdraw(address to, uint256 amount) external onlyOwner { IERC20(token).transfer(to, amount); } /** * @dev Update the fee on the current chain. Only call-able by the owner * @param newFee uint - the new fee that applies to the current side bridge */ function updateFee(uint newFee) external onlyOwner { uint oldFee = fee; fee = newFee; emit LogFeeUpdate(oldFee, newFee); } /** * @dev Add Liquidity to the Bridge contract * @param amount uint256 - the amount added to the liquidity in the bridge */ function addLiquidity(uint256 amount) external { IERC20(token).transferFrom(msg.sender, address(this), amount); emit LogLiquidityAdded(msg.sender, amount); } }
addLiquidity
function addLiquidity(uint256 amount) external { IERC20(token).transferFrom(msg.sender, address(this), amount); emit LogLiquidityAdded(msg.sender, amount); }
/** * @dev Add Liquidity to the Bridge contract * @param amount uint256 - the amount added to the liquidity in the bridge */
NatSpecMultiLine
v0.8.0+commit.c7dfd78e
{ "func_code_index": [ 2928, 3109 ] }
58,761
MineBee
contracts\mine.sol
0x8d8129963291740dddd917ab01af18c7aed4ba58
Solidity
MineBee
contract MineBee is ERC20 { string public constant name = "MineBee"; // solium-disable-line uppercase string public constant symbol = "MB"; // solium-disable-line uppercase uint8 public constant decimals = 18; // solium-disable-line uppercase uint256 public constant initialSupply = 5000000000 * (10 ** uint256(decimals)); constructor() public { super._mint(msg.sender, initialSupply); owner = msg.sender; } //ownership address public owner; event OwnershipRenounced(address indexed previousOwner); event OwnershipTransferred( address indexed previousOwner, address indexed newOwner ); modifier onlyOwner() { require(msg.sender == owner, "Not owner"); _; } /** * @dev Allows the current owner to relinquish control of the contract. * @notice Renouncing to ownership will leave the contract without an owner. * It will not be possible to call the functions with the `onlyOwner` * modifier anymore. */ function renounceOwnership() public onlyOwner { emit OwnershipRenounced(owner); owner = address(0); } /** * @dev Allows the current owner to transfer control of the contract to a newOwner. * @param _newOwner The address to transfer ownership to. */ function transferOwnership(address _newOwner) public onlyOwner { _transferOwnership(_newOwner); } /** * @dev Transfers control of the contract to a newOwner. * @param _newOwner The address to transfer ownership to. */ function _transferOwnership(address _newOwner) internal { require(_newOwner != address(0), "Already owner"); emit OwnershipTransferred(owner, _newOwner); owner = _newOwner; } //pausable event Pause(); event Unpause(); bool public paused = false; /** * @dev Modifier to make a function callable only when the contract is not paused. */ modifier whenNotPaused() { require(!paused, "Paused by owner"); _; } /** * @dev Modifier to make a function callable only when the contract is paused. */ modifier whenPaused() { require(paused, "Not paused now"); _; } /** * @dev called by the owner to pause, triggers stopped state */ function pause() public onlyOwner whenNotPaused { paused = true; emit Pause(); } /** * @dev called by the owner to unpause, returns to normal state */ function unpause() public onlyOwner whenPaused { paused = false; emit Unpause(); } //freezable event Frozen(address target); event Unfrozen(address target); mapping(address => bool) internal freezes; modifier whenNotFrozen() { require(!freezes[msg.sender], "Sender account is locked."); _; } function freeze(address _target) public onlyOwner { freezes[_target] = true; emit Frozen(_target); } function unfreeze(address _target) public onlyOwner { freezes[_target] = false; emit Unfrozen(_target); } function isFrozen(address _target) public view returns (bool) { return freezes[_target]; } function transfer( address _to, uint256 _value ) public whenNotFrozen whenNotPaused returns (bool) { releaseLock(msg.sender); return super.transfer(_to, _value); } function transferFrom( address _from, address _to, uint256 _value ) public whenNotPaused returns (bool) { require(!freezes[_from], "From account is locked."); releaseLock(_from); return super.transferFrom(_from, _to, _value); } //mintable event Mint(address indexed to, uint256 amount); function mint( address _to, uint256 _amount ) public onlyOwner returns (bool) { super._mint(_to, _amount); emit Mint(_to, _amount); return true; } //burnable event Burn(address indexed burner, uint256 value); function burn(address _who, uint256 _value) public onlyOwner { require(_value <= super.balanceOf(_who), "Balance is too small."); _burn(_who, _value); emit Burn(_who, _value); } //lockable struct LockInfo { uint256 releaseTime; uint256 balance; } mapping(address => LockInfo[]) internal lockInfo; event Lock(address indexed holder, uint256 value, uint256 releaseTime); event Unlock(address indexed holder, uint256 value); function balanceOf(address _holder) public view returns (uint256 balance) { uint256 lockedBalance = 0; for(uint256 i = 0; i < lockInfo[_holder].length ; i++ ) { lockedBalance = lockedBalance.add(lockInfo[_holder][i].balance); } return super.balanceOf(_holder).add(lockedBalance); } function releaseLock(address _holder) internal { for(uint256 i = 0; i < lockInfo[_holder].length ; i++ ) { if (lockInfo[_holder][i].releaseTime <= now) { _balances[_holder] = _balances[_holder].add(lockInfo[_holder][i].balance); emit Unlock(_holder, lockInfo[_holder][i].balance); lockInfo[_holder][i].balance = 0; if (i != lockInfo[_holder].length - 1) { lockInfo[_holder][i] = lockInfo[_holder][lockInfo[_holder].length - 1]; i--; } lockInfo[_holder].length--; } } } function lockCount(address _holder) public view returns (uint256) { return lockInfo[_holder].length; } function lockState(address _holder, uint256 _idx) public view returns (uint256, uint256) { return (lockInfo[_holder][_idx].releaseTime, lockInfo[_holder][_idx].balance); } function lock(address _holder, uint256 _amount, uint256 _releaseTime) public onlyOwner { require(super.balanceOf(_holder) >= _amount, "Balance is too small."); _balances[_holder] = _balances[_holder].sub(_amount); lockInfo[_holder].push( LockInfo(_releaseTime, _amount) ); emit Lock(_holder, _amount, _releaseTime); } function lockAfter(address _holder, uint256 _amount, uint256 _afterTime) public onlyOwner { require(super.balanceOf(_holder) >= _amount, "Balance is too small."); _balances[_holder] = _balances[_holder].sub(_amount); lockInfo[_holder].push( LockInfo(now + _afterTime, _amount) ); emit Lock(_holder, _amount, now + _afterTime); } function unlock(address _holder, uint256 i) public onlyOwner { require(i < lockInfo[_holder].length, "No lock information."); _balances[_holder] = _balances[_holder].add(lockInfo[_holder][i].balance); emit Unlock(_holder, lockInfo[_holder][i].balance); lockInfo[_holder][i].balance = 0; if (i != lockInfo[_holder].length - 1) { lockInfo[_holder][i] = lockInfo[_holder][lockInfo[_holder].length - 1]; } lockInfo[_holder].length--; } function transferWithLock(address _to, uint256 _value, uint256 _releaseTime) public onlyOwner returns (bool) { require(_to != address(0), "wrong address"); require(_value <= super.balanceOf(owner), "Not enough balance"); _balances[owner] = _balances[owner].sub(_value); lockInfo[_to].push( LockInfo(_releaseTime, _value) ); emit Transfer(owner, _to, _value); emit Lock(_to, _value, _releaseTime); return true; } function transferWithLockAfter(address _to, uint256 _value, uint256 _afterTime) public onlyOwner returns (bool) { require(_to != address(0), "wrong address"); require(_value <= super.balanceOf(owner), "Not enough balance"); _balances[owner] = _balances[owner].sub(_value); lockInfo[_to].push( LockInfo(now + _afterTime, _value) ); emit Transfer(owner, _to, _value); emit Lock(_to, _value, now + _afterTime); return true; } function currentTime() public view returns (uint256) { return now; } function afterTime(uint256 _value) public view returns (uint256) { return now + _value; } }
renounceOwnership
function renounceOwnership() public onlyOwner { emit OwnershipRenounced(owner); owner = address(0); }
/** * @dev Allows the current owner to relinquish control of the contract. * @notice Renouncing to ownership will leave the contract without an owner. * It will not be possible to call the functions with the `onlyOwner` * modifier anymore. */
NatSpecMultiLine
v0.5.4+commit.9549d8ff
bzzr://419a8ce13d86a8a2550e594d21bfdaa2aa44c7d3784a624060f21fb5d920e78d
{ "func_code_index": [ 1049, 1178 ] }
58,762
MineBee
contracts\mine.sol
0x8d8129963291740dddd917ab01af18c7aed4ba58
Solidity
MineBee
contract MineBee is ERC20 { string public constant name = "MineBee"; // solium-disable-line uppercase string public constant symbol = "MB"; // solium-disable-line uppercase uint8 public constant decimals = 18; // solium-disable-line uppercase uint256 public constant initialSupply = 5000000000 * (10 ** uint256(decimals)); constructor() public { super._mint(msg.sender, initialSupply); owner = msg.sender; } //ownership address public owner; event OwnershipRenounced(address indexed previousOwner); event OwnershipTransferred( address indexed previousOwner, address indexed newOwner ); modifier onlyOwner() { require(msg.sender == owner, "Not owner"); _; } /** * @dev Allows the current owner to relinquish control of the contract. * @notice Renouncing to ownership will leave the contract without an owner. * It will not be possible to call the functions with the `onlyOwner` * modifier anymore. */ function renounceOwnership() public onlyOwner { emit OwnershipRenounced(owner); owner = address(0); } /** * @dev Allows the current owner to transfer control of the contract to a newOwner. * @param _newOwner The address to transfer ownership to. */ function transferOwnership(address _newOwner) public onlyOwner { _transferOwnership(_newOwner); } /** * @dev Transfers control of the contract to a newOwner. * @param _newOwner The address to transfer ownership to. */ function _transferOwnership(address _newOwner) internal { require(_newOwner != address(0), "Already owner"); emit OwnershipTransferred(owner, _newOwner); owner = _newOwner; } //pausable event Pause(); event Unpause(); bool public paused = false; /** * @dev Modifier to make a function callable only when the contract is not paused. */ modifier whenNotPaused() { require(!paused, "Paused by owner"); _; } /** * @dev Modifier to make a function callable only when the contract is paused. */ modifier whenPaused() { require(paused, "Not paused now"); _; } /** * @dev called by the owner to pause, triggers stopped state */ function pause() public onlyOwner whenNotPaused { paused = true; emit Pause(); } /** * @dev called by the owner to unpause, returns to normal state */ function unpause() public onlyOwner whenPaused { paused = false; emit Unpause(); } //freezable event Frozen(address target); event Unfrozen(address target); mapping(address => bool) internal freezes; modifier whenNotFrozen() { require(!freezes[msg.sender], "Sender account is locked."); _; } function freeze(address _target) public onlyOwner { freezes[_target] = true; emit Frozen(_target); } function unfreeze(address _target) public onlyOwner { freezes[_target] = false; emit Unfrozen(_target); } function isFrozen(address _target) public view returns (bool) { return freezes[_target]; } function transfer( address _to, uint256 _value ) public whenNotFrozen whenNotPaused returns (bool) { releaseLock(msg.sender); return super.transfer(_to, _value); } function transferFrom( address _from, address _to, uint256 _value ) public whenNotPaused returns (bool) { require(!freezes[_from], "From account is locked."); releaseLock(_from); return super.transferFrom(_from, _to, _value); } //mintable event Mint(address indexed to, uint256 amount); function mint( address _to, uint256 _amount ) public onlyOwner returns (bool) { super._mint(_to, _amount); emit Mint(_to, _amount); return true; } //burnable event Burn(address indexed burner, uint256 value); function burn(address _who, uint256 _value) public onlyOwner { require(_value <= super.balanceOf(_who), "Balance is too small."); _burn(_who, _value); emit Burn(_who, _value); } //lockable struct LockInfo { uint256 releaseTime; uint256 balance; } mapping(address => LockInfo[]) internal lockInfo; event Lock(address indexed holder, uint256 value, uint256 releaseTime); event Unlock(address indexed holder, uint256 value); function balanceOf(address _holder) public view returns (uint256 balance) { uint256 lockedBalance = 0; for(uint256 i = 0; i < lockInfo[_holder].length ; i++ ) { lockedBalance = lockedBalance.add(lockInfo[_holder][i].balance); } return super.balanceOf(_holder).add(lockedBalance); } function releaseLock(address _holder) internal { for(uint256 i = 0; i < lockInfo[_holder].length ; i++ ) { if (lockInfo[_holder][i].releaseTime <= now) { _balances[_holder] = _balances[_holder].add(lockInfo[_holder][i].balance); emit Unlock(_holder, lockInfo[_holder][i].balance); lockInfo[_holder][i].balance = 0; if (i != lockInfo[_holder].length - 1) { lockInfo[_holder][i] = lockInfo[_holder][lockInfo[_holder].length - 1]; i--; } lockInfo[_holder].length--; } } } function lockCount(address _holder) public view returns (uint256) { return lockInfo[_holder].length; } function lockState(address _holder, uint256 _idx) public view returns (uint256, uint256) { return (lockInfo[_holder][_idx].releaseTime, lockInfo[_holder][_idx].balance); } function lock(address _holder, uint256 _amount, uint256 _releaseTime) public onlyOwner { require(super.balanceOf(_holder) >= _amount, "Balance is too small."); _balances[_holder] = _balances[_holder].sub(_amount); lockInfo[_holder].push( LockInfo(_releaseTime, _amount) ); emit Lock(_holder, _amount, _releaseTime); } function lockAfter(address _holder, uint256 _amount, uint256 _afterTime) public onlyOwner { require(super.balanceOf(_holder) >= _amount, "Balance is too small."); _balances[_holder] = _balances[_holder].sub(_amount); lockInfo[_holder].push( LockInfo(now + _afterTime, _amount) ); emit Lock(_holder, _amount, now + _afterTime); } function unlock(address _holder, uint256 i) public onlyOwner { require(i < lockInfo[_holder].length, "No lock information."); _balances[_holder] = _balances[_holder].add(lockInfo[_holder][i].balance); emit Unlock(_holder, lockInfo[_holder][i].balance); lockInfo[_holder][i].balance = 0; if (i != lockInfo[_holder].length - 1) { lockInfo[_holder][i] = lockInfo[_holder][lockInfo[_holder].length - 1]; } lockInfo[_holder].length--; } function transferWithLock(address _to, uint256 _value, uint256 _releaseTime) public onlyOwner returns (bool) { require(_to != address(0), "wrong address"); require(_value <= super.balanceOf(owner), "Not enough balance"); _balances[owner] = _balances[owner].sub(_value); lockInfo[_to].push( LockInfo(_releaseTime, _value) ); emit Transfer(owner, _to, _value); emit Lock(_to, _value, _releaseTime); return true; } function transferWithLockAfter(address _to, uint256 _value, uint256 _afterTime) public onlyOwner returns (bool) { require(_to != address(0), "wrong address"); require(_value <= super.balanceOf(owner), "Not enough balance"); _balances[owner] = _balances[owner].sub(_value); lockInfo[_to].push( LockInfo(now + _afterTime, _value) ); emit Transfer(owner, _to, _value); emit Lock(_to, _value, now + _afterTime); return true; } function currentTime() public view returns (uint256) { return now; } function afterTime(uint256 _value) public view returns (uint256) { return now + _value; } }
transferOwnership
function transferOwnership(address _newOwner) public onlyOwner { _transferOwnership(_newOwner); }
/** * @dev Allows the current owner to transfer control of the contract to a newOwner. * @param _newOwner The address to transfer ownership to. */
NatSpecMultiLine
v0.5.4+commit.9549d8ff
bzzr://419a8ce13d86a8a2550e594d21bfdaa2aa44c7d3784a624060f21fb5d920e78d
{ "func_code_index": [ 1343, 1459 ] }
58,763
MineBee
contracts\mine.sol
0x8d8129963291740dddd917ab01af18c7aed4ba58
Solidity
MineBee
contract MineBee is ERC20 { string public constant name = "MineBee"; // solium-disable-line uppercase string public constant symbol = "MB"; // solium-disable-line uppercase uint8 public constant decimals = 18; // solium-disable-line uppercase uint256 public constant initialSupply = 5000000000 * (10 ** uint256(decimals)); constructor() public { super._mint(msg.sender, initialSupply); owner = msg.sender; } //ownership address public owner; event OwnershipRenounced(address indexed previousOwner); event OwnershipTransferred( address indexed previousOwner, address indexed newOwner ); modifier onlyOwner() { require(msg.sender == owner, "Not owner"); _; } /** * @dev Allows the current owner to relinquish control of the contract. * @notice Renouncing to ownership will leave the contract without an owner. * It will not be possible to call the functions with the `onlyOwner` * modifier anymore. */ function renounceOwnership() public onlyOwner { emit OwnershipRenounced(owner); owner = address(0); } /** * @dev Allows the current owner to transfer control of the contract to a newOwner. * @param _newOwner The address to transfer ownership to. */ function transferOwnership(address _newOwner) public onlyOwner { _transferOwnership(_newOwner); } /** * @dev Transfers control of the contract to a newOwner. * @param _newOwner The address to transfer ownership to. */ function _transferOwnership(address _newOwner) internal { require(_newOwner != address(0), "Already owner"); emit OwnershipTransferred(owner, _newOwner); owner = _newOwner; } //pausable event Pause(); event Unpause(); bool public paused = false; /** * @dev Modifier to make a function callable only when the contract is not paused. */ modifier whenNotPaused() { require(!paused, "Paused by owner"); _; } /** * @dev Modifier to make a function callable only when the contract is paused. */ modifier whenPaused() { require(paused, "Not paused now"); _; } /** * @dev called by the owner to pause, triggers stopped state */ function pause() public onlyOwner whenNotPaused { paused = true; emit Pause(); } /** * @dev called by the owner to unpause, returns to normal state */ function unpause() public onlyOwner whenPaused { paused = false; emit Unpause(); } //freezable event Frozen(address target); event Unfrozen(address target); mapping(address => bool) internal freezes; modifier whenNotFrozen() { require(!freezes[msg.sender], "Sender account is locked."); _; } function freeze(address _target) public onlyOwner { freezes[_target] = true; emit Frozen(_target); } function unfreeze(address _target) public onlyOwner { freezes[_target] = false; emit Unfrozen(_target); } function isFrozen(address _target) public view returns (bool) { return freezes[_target]; } function transfer( address _to, uint256 _value ) public whenNotFrozen whenNotPaused returns (bool) { releaseLock(msg.sender); return super.transfer(_to, _value); } function transferFrom( address _from, address _to, uint256 _value ) public whenNotPaused returns (bool) { require(!freezes[_from], "From account is locked."); releaseLock(_from); return super.transferFrom(_from, _to, _value); } //mintable event Mint(address indexed to, uint256 amount); function mint( address _to, uint256 _amount ) public onlyOwner returns (bool) { super._mint(_to, _amount); emit Mint(_to, _amount); return true; } //burnable event Burn(address indexed burner, uint256 value); function burn(address _who, uint256 _value) public onlyOwner { require(_value <= super.balanceOf(_who), "Balance is too small."); _burn(_who, _value); emit Burn(_who, _value); } //lockable struct LockInfo { uint256 releaseTime; uint256 balance; } mapping(address => LockInfo[]) internal lockInfo; event Lock(address indexed holder, uint256 value, uint256 releaseTime); event Unlock(address indexed holder, uint256 value); function balanceOf(address _holder) public view returns (uint256 balance) { uint256 lockedBalance = 0; for(uint256 i = 0; i < lockInfo[_holder].length ; i++ ) { lockedBalance = lockedBalance.add(lockInfo[_holder][i].balance); } return super.balanceOf(_holder).add(lockedBalance); } function releaseLock(address _holder) internal { for(uint256 i = 0; i < lockInfo[_holder].length ; i++ ) { if (lockInfo[_holder][i].releaseTime <= now) { _balances[_holder] = _balances[_holder].add(lockInfo[_holder][i].balance); emit Unlock(_holder, lockInfo[_holder][i].balance); lockInfo[_holder][i].balance = 0; if (i != lockInfo[_holder].length - 1) { lockInfo[_holder][i] = lockInfo[_holder][lockInfo[_holder].length - 1]; i--; } lockInfo[_holder].length--; } } } function lockCount(address _holder) public view returns (uint256) { return lockInfo[_holder].length; } function lockState(address _holder, uint256 _idx) public view returns (uint256, uint256) { return (lockInfo[_holder][_idx].releaseTime, lockInfo[_holder][_idx].balance); } function lock(address _holder, uint256 _amount, uint256 _releaseTime) public onlyOwner { require(super.balanceOf(_holder) >= _amount, "Balance is too small."); _balances[_holder] = _balances[_holder].sub(_amount); lockInfo[_holder].push( LockInfo(_releaseTime, _amount) ); emit Lock(_holder, _amount, _releaseTime); } function lockAfter(address _holder, uint256 _amount, uint256 _afterTime) public onlyOwner { require(super.balanceOf(_holder) >= _amount, "Balance is too small."); _balances[_holder] = _balances[_holder].sub(_amount); lockInfo[_holder].push( LockInfo(now + _afterTime, _amount) ); emit Lock(_holder, _amount, now + _afterTime); } function unlock(address _holder, uint256 i) public onlyOwner { require(i < lockInfo[_holder].length, "No lock information."); _balances[_holder] = _balances[_holder].add(lockInfo[_holder][i].balance); emit Unlock(_holder, lockInfo[_holder][i].balance); lockInfo[_holder][i].balance = 0; if (i != lockInfo[_holder].length - 1) { lockInfo[_holder][i] = lockInfo[_holder][lockInfo[_holder].length - 1]; } lockInfo[_holder].length--; } function transferWithLock(address _to, uint256 _value, uint256 _releaseTime) public onlyOwner returns (bool) { require(_to != address(0), "wrong address"); require(_value <= super.balanceOf(owner), "Not enough balance"); _balances[owner] = _balances[owner].sub(_value); lockInfo[_to].push( LockInfo(_releaseTime, _value) ); emit Transfer(owner, _to, _value); emit Lock(_to, _value, _releaseTime); return true; } function transferWithLockAfter(address _to, uint256 _value, uint256 _afterTime) public onlyOwner returns (bool) { require(_to != address(0), "wrong address"); require(_value <= super.balanceOf(owner), "Not enough balance"); _balances[owner] = _balances[owner].sub(_value); lockInfo[_to].push( LockInfo(now + _afterTime, _value) ); emit Transfer(owner, _to, _value); emit Lock(_to, _value, now + _afterTime); return true; } function currentTime() public view returns (uint256) { return now; } function afterTime(uint256 _value) public view returns (uint256) { return now + _value; } }
_transferOwnership
function _transferOwnership(address _newOwner) internal { require(_newOwner != address(0), "Already owner"); emit OwnershipTransferred(owner, _newOwner); owner = _newOwner; }
/** * @dev Transfers control of the contract to a newOwner. * @param _newOwner The address to transfer ownership to. */
NatSpecMultiLine
v0.5.4+commit.9549d8ff
bzzr://419a8ce13d86a8a2550e594d21bfdaa2aa44c7d3784a624060f21fb5d920e78d
{ "func_code_index": [ 1597, 1808 ] }
58,764
MineBee
contracts\mine.sol
0x8d8129963291740dddd917ab01af18c7aed4ba58
Solidity
MineBee
contract MineBee is ERC20 { string public constant name = "MineBee"; // solium-disable-line uppercase string public constant symbol = "MB"; // solium-disable-line uppercase uint8 public constant decimals = 18; // solium-disable-line uppercase uint256 public constant initialSupply = 5000000000 * (10 ** uint256(decimals)); constructor() public { super._mint(msg.sender, initialSupply); owner = msg.sender; } //ownership address public owner; event OwnershipRenounced(address indexed previousOwner); event OwnershipTransferred( address indexed previousOwner, address indexed newOwner ); modifier onlyOwner() { require(msg.sender == owner, "Not owner"); _; } /** * @dev Allows the current owner to relinquish control of the contract. * @notice Renouncing to ownership will leave the contract without an owner. * It will not be possible to call the functions with the `onlyOwner` * modifier anymore. */ function renounceOwnership() public onlyOwner { emit OwnershipRenounced(owner); owner = address(0); } /** * @dev Allows the current owner to transfer control of the contract to a newOwner. * @param _newOwner The address to transfer ownership to. */ function transferOwnership(address _newOwner) public onlyOwner { _transferOwnership(_newOwner); } /** * @dev Transfers control of the contract to a newOwner. * @param _newOwner The address to transfer ownership to. */ function _transferOwnership(address _newOwner) internal { require(_newOwner != address(0), "Already owner"); emit OwnershipTransferred(owner, _newOwner); owner = _newOwner; } //pausable event Pause(); event Unpause(); bool public paused = false; /** * @dev Modifier to make a function callable only when the contract is not paused. */ modifier whenNotPaused() { require(!paused, "Paused by owner"); _; } /** * @dev Modifier to make a function callable only when the contract is paused. */ modifier whenPaused() { require(paused, "Not paused now"); _; } /** * @dev called by the owner to pause, triggers stopped state */ function pause() public onlyOwner whenNotPaused { paused = true; emit Pause(); } /** * @dev called by the owner to unpause, returns to normal state */ function unpause() public onlyOwner whenPaused { paused = false; emit Unpause(); } //freezable event Frozen(address target); event Unfrozen(address target); mapping(address => bool) internal freezes; modifier whenNotFrozen() { require(!freezes[msg.sender], "Sender account is locked."); _; } function freeze(address _target) public onlyOwner { freezes[_target] = true; emit Frozen(_target); } function unfreeze(address _target) public onlyOwner { freezes[_target] = false; emit Unfrozen(_target); } function isFrozen(address _target) public view returns (bool) { return freezes[_target]; } function transfer( address _to, uint256 _value ) public whenNotFrozen whenNotPaused returns (bool) { releaseLock(msg.sender); return super.transfer(_to, _value); } function transferFrom( address _from, address _to, uint256 _value ) public whenNotPaused returns (bool) { require(!freezes[_from], "From account is locked."); releaseLock(_from); return super.transferFrom(_from, _to, _value); } //mintable event Mint(address indexed to, uint256 amount); function mint( address _to, uint256 _amount ) public onlyOwner returns (bool) { super._mint(_to, _amount); emit Mint(_to, _amount); return true; } //burnable event Burn(address indexed burner, uint256 value); function burn(address _who, uint256 _value) public onlyOwner { require(_value <= super.balanceOf(_who), "Balance is too small."); _burn(_who, _value); emit Burn(_who, _value); } //lockable struct LockInfo { uint256 releaseTime; uint256 balance; } mapping(address => LockInfo[]) internal lockInfo; event Lock(address indexed holder, uint256 value, uint256 releaseTime); event Unlock(address indexed holder, uint256 value); function balanceOf(address _holder) public view returns (uint256 balance) { uint256 lockedBalance = 0; for(uint256 i = 0; i < lockInfo[_holder].length ; i++ ) { lockedBalance = lockedBalance.add(lockInfo[_holder][i].balance); } return super.balanceOf(_holder).add(lockedBalance); } function releaseLock(address _holder) internal { for(uint256 i = 0; i < lockInfo[_holder].length ; i++ ) { if (lockInfo[_holder][i].releaseTime <= now) { _balances[_holder] = _balances[_holder].add(lockInfo[_holder][i].balance); emit Unlock(_holder, lockInfo[_holder][i].balance); lockInfo[_holder][i].balance = 0; if (i != lockInfo[_holder].length - 1) { lockInfo[_holder][i] = lockInfo[_holder][lockInfo[_holder].length - 1]; i--; } lockInfo[_holder].length--; } } } function lockCount(address _holder) public view returns (uint256) { return lockInfo[_holder].length; } function lockState(address _holder, uint256 _idx) public view returns (uint256, uint256) { return (lockInfo[_holder][_idx].releaseTime, lockInfo[_holder][_idx].balance); } function lock(address _holder, uint256 _amount, uint256 _releaseTime) public onlyOwner { require(super.balanceOf(_holder) >= _amount, "Balance is too small."); _balances[_holder] = _balances[_holder].sub(_amount); lockInfo[_holder].push( LockInfo(_releaseTime, _amount) ); emit Lock(_holder, _amount, _releaseTime); } function lockAfter(address _holder, uint256 _amount, uint256 _afterTime) public onlyOwner { require(super.balanceOf(_holder) >= _amount, "Balance is too small."); _balances[_holder] = _balances[_holder].sub(_amount); lockInfo[_holder].push( LockInfo(now + _afterTime, _amount) ); emit Lock(_holder, _amount, now + _afterTime); } function unlock(address _holder, uint256 i) public onlyOwner { require(i < lockInfo[_holder].length, "No lock information."); _balances[_holder] = _balances[_holder].add(lockInfo[_holder][i].balance); emit Unlock(_holder, lockInfo[_holder][i].balance); lockInfo[_holder][i].balance = 0; if (i != lockInfo[_holder].length - 1) { lockInfo[_holder][i] = lockInfo[_holder][lockInfo[_holder].length - 1]; } lockInfo[_holder].length--; } function transferWithLock(address _to, uint256 _value, uint256 _releaseTime) public onlyOwner returns (bool) { require(_to != address(0), "wrong address"); require(_value <= super.balanceOf(owner), "Not enough balance"); _balances[owner] = _balances[owner].sub(_value); lockInfo[_to].push( LockInfo(_releaseTime, _value) ); emit Transfer(owner, _to, _value); emit Lock(_to, _value, _releaseTime); return true; } function transferWithLockAfter(address _to, uint256 _value, uint256 _afterTime) public onlyOwner returns (bool) { require(_to != address(0), "wrong address"); require(_value <= super.balanceOf(owner), "Not enough balance"); _balances[owner] = _balances[owner].sub(_value); lockInfo[_to].push( LockInfo(now + _afterTime, _value) ); emit Transfer(owner, _to, _value); emit Lock(_to, _value, now + _afterTime); return true; } function currentTime() public view returns (uint256) { return now; } function afterTime(uint256 _value) public view returns (uint256) { return now + _value; } }
pause
function pause() public onlyOwner whenNotPaused { paused = true; emit Pause(); }
/** * @dev called by the owner to pause, triggers stopped state */
NatSpecMultiLine
v0.5.4+commit.9549d8ff
bzzr://419a8ce13d86a8a2550e594d21bfdaa2aa44c7d3784a624060f21fb5d920e78d
{ "func_code_index": [ 2389, 2497 ] }
58,765
MineBee
contracts\mine.sol
0x8d8129963291740dddd917ab01af18c7aed4ba58
Solidity
MineBee
contract MineBee is ERC20 { string public constant name = "MineBee"; // solium-disable-line uppercase string public constant symbol = "MB"; // solium-disable-line uppercase uint8 public constant decimals = 18; // solium-disable-line uppercase uint256 public constant initialSupply = 5000000000 * (10 ** uint256(decimals)); constructor() public { super._mint(msg.sender, initialSupply); owner = msg.sender; } //ownership address public owner; event OwnershipRenounced(address indexed previousOwner); event OwnershipTransferred( address indexed previousOwner, address indexed newOwner ); modifier onlyOwner() { require(msg.sender == owner, "Not owner"); _; } /** * @dev Allows the current owner to relinquish control of the contract. * @notice Renouncing to ownership will leave the contract without an owner. * It will not be possible to call the functions with the `onlyOwner` * modifier anymore. */ function renounceOwnership() public onlyOwner { emit OwnershipRenounced(owner); owner = address(0); } /** * @dev Allows the current owner to transfer control of the contract to a newOwner. * @param _newOwner The address to transfer ownership to. */ function transferOwnership(address _newOwner) public onlyOwner { _transferOwnership(_newOwner); } /** * @dev Transfers control of the contract to a newOwner. * @param _newOwner The address to transfer ownership to. */ function _transferOwnership(address _newOwner) internal { require(_newOwner != address(0), "Already owner"); emit OwnershipTransferred(owner, _newOwner); owner = _newOwner; } //pausable event Pause(); event Unpause(); bool public paused = false; /** * @dev Modifier to make a function callable only when the contract is not paused. */ modifier whenNotPaused() { require(!paused, "Paused by owner"); _; } /** * @dev Modifier to make a function callable only when the contract is paused. */ modifier whenPaused() { require(paused, "Not paused now"); _; } /** * @dev called by the owner to pause, triggers stopped state */ function pause() public onlyOwner whenNotPaused { paused = true; emit Pause(); } /** * @dev called by the owner to unpause, returns to normal state */ function unpause() public onlyOwner whenPaused { paused = false; emit Unpause(); } //freezable event Frozen(address target); event Unfrozen(address target); mapping(address => bool) internal freezes; modifier whenNotFrozen() { require(!freezes[msg.sender], "Sender account is locked."); _; } function freeze(address _target) public onlyOwner { freezes[_target] = true; emit Frozen(_target); } function unfreeze(address _target) public onlyOwner { freezes[_target] = false; emit Unfrozen(_target); } function isFrozen(address _target) public view returns (bool) { return freezes[_target]; } function transfer( address _to, uint256 _value ) public whenNotFrozen whenNotPaused returns (bool) { releaseLock(msg.sender); return super.transfer(_to, _value); } function transferFrom( address _from, address _to, uint256 _value ) public whenNotPaused returns (bool) { require(!freezes[_from], "From account is locked."); releaseLock(_from); return super.transferFrom(_from, _to, _value); } //mintable event Mint(address indexed to, uint256 amount); function mint( address _to, uint256 _amount ) public onlyOwner returns (bool) { super._mint(_to, _amount); emit Mint(_to, _amount); return true; } //burnable event Burn(address indexed burner, uint256 value); function burn(address _who, uint256 _value) public onlyOwner { require(_value <= super.balanceOf(_who), "Balance is too small."); _burn(_who, _value); emit Burn(_who, _value); } //lockable struct LockInfo { uint256 releaseTime; uint256 balance; } mapping(address => LockInfo[]) internal lockInfo; event Lock(address indexed holder, uint256 value, uint256 releaseTime); event Unlock(address indexed holder, uint256 value); function balanceOf(address _holder) public view returns (uint256 balance) { uint256 lockedBalance = 0; for(uint256 i = 0; i < lockInfo[_holder].length ; i++ ) { lockedBalance = lockedBalance.add(lockInfo[_holder][i].balance); } return super.balanceOf(_holder).add(lockedBalance); } function releaseLock(address _holder) internal { for(uint256 i = 0; i < lockInfo[_holder].length ; i++ ) { if (lockInfo[_holder][i].releaseTime <= now) { _balances[_holder] = _balances[_holder].add(lockInfo[_holder][i].balance); emit Unlock(_holder, lockInfo[_holder][i].balance); lockInfo[_holder][i].balance = 0; if (i != lockInfo[_holder].length - 1) { lockInfo[_holder][i] = lockInfo[_holder][lockInfo[_holder].length - 1]; i--; } lockInfo[_holder].length--; } } } function lockCount(address _holder) public view returns (uint256) { return lockInfo[_holder].length; } function lockState(address _holder, uint256 _idx) public view returns (uint256, uint256) { return (lockInfo[_holder][_idx].releaseTime, lockInfo[_holder][_idx].balance); } function lock(address _holder, uint256 _amount, uint256 _releaseTime) public onlyOwner { require(super.balanceOf(_holder) >= _amount, "Balance is too small."); _balances[_holder] = _balances[_holder].sub(_amount); lockInfo[_holder].push( LockInfo(_releaseTime, _amount) ); emit Lock(_holder, _amount, _releaseTime); } function lockAfter(address _holder, uint256 _amount, uint256 _afterTime) public onlyOwner { require(super.balanceOf(_holder) >= _amount, "Balance is too small."); _balances[_holder] = _balances[_holder].sub(_amount); lockInfo[_holder].push( LockInfo(now + _afterTime, _amount) ); emit Lock(_holder, _amount, now + _afterTime); } function unlock(address _holder, uint256 i) public onlyOwner { require(i < lockInfo[_holder].length, "No lock information."); _balances[_holder] = _balances[_holder].add(lockInfo[_holder][i].balance); emit Unlock(_holder, lockInfo[_holder][i].balance); lockInfo[_holder][i].balance = 0; if (i != lockInfo[_holder].length - 1) { lockInfo[_holder][i] = lockInfo[_holder][lockInfo[_holder].length - 1]; } lockInfo[_holder].length--; } function transferWithLock(address _to, uint256 _value, uint256 _releaseTime) public onlyOwner returns (bool) { require(_to != address(0), "wrong address"); require(_value <= super.balanceOf(owner), "Not enough balance"); _balances[owner] = _balances[owner].sub(_value); lockInfo[_to].push( LockInfo(_releaseTime, _value) ); emit Transfer(owner, _to, _value); emit Lock(_to, _value, _releaseTime); return true; } function transferWithLockAfter(address _to, uint256 _value, uint256 _afterTime) public onlyOwner returns (bool) { require(_to != address(0), "wrong address"); require(_value <= super.balanceOf(owner), "Not enough balance"); _balances[owner] = _balances[owner].sub(_value); lockInfo[_to].push( LockInfo(now + _afterTime, _value) ); emit Transfer(owner, _to, _value); emit Lock(_to, _value, now + _afterTime); return true; } function currentTime() public view returns (uint256) { return now; } function afterTime(uint256 _value) public view returns (uint256) { return now + _value; } }
unpause
function unpause() public onlyOwner whenPaused { paused = false; emit Unpause(); }
/** * @dev called by the owner to unpause, returns to normal state */
NatSpecMultiLine
v0.5.4+commit.9549d8ff
bzzr://419a8ce13d86a8a2550e594d21bfdaa2aa44c7d3784a624060f21fb5d920e78d
{ "func_code_index": [ 2585, 2695 ] }
58,766
NiftyToken
NiftyToken.sol
0xf08ed21ce4f49eb9a93f9af745e7beeeca6e49cc
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.8.2+commit.661d1103
None
ipfs://460d4208d7497d2e10a0493d70940826df3698010159966d92038dc5506103da
{ "func_code_index": [ 94, 154 ] }
58,767
NiftyToken
NiftyToken.sol
0xf08ed21ce4f49eb9a93f9af745e7beeeca6e49cc
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.8.2+commit.661d1103
None
ipfs://460d4208d7497d2e10a0493d70940826df3698010159966d92038dc5506103da
{ "func_code_index": [ 237, 310 ] }
58,768
NiftyToken
NiftyToken.sol
0xf08ed21ce4f49eb9a93f9af745e7beeeca6e49cc
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.8.2+commit.661d1103
None
ipfs://460d4208d7497d2e10a0493d70940826df3698010159966d92038dc5506103da
{ "func_code_index": [ 534, 616 ] }
58,769
NiftyToken
NiftyToken.sol
0xf08ed21ce4f49eb9a93f9af745e7beeeca6e49cc
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.8.2+commit.661d1103
None
ipfs://460d4208d7497d2e10a0493d70940826df3698010159966d92038dc5506103da
{ "func_code_index": [ 895, 983 ] }
58,770
NiftyToken
NiftyToken.sol
0xf08ed21ce4f49eb9a93f9af745e7beeeca6e49cc
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.8.2+commit.661d1103
None
ipfs://460d4208d7497d2e10a0493d70940826df3698010159966d92038dc5506103da
{ "func_code_index": [ 1647, 1726 ] }
58,771
NiftyToken
NiftyToken.sol
0xf08ed21ce4f49eb9a93f9af745e7beeeca6e49cc
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.8.2+commit.661d1103
None
ipfs://460d4208d7497d2e10a0493d70940826df3698010159966d92038dc5506103da
{ "func_code_index": [ 2039, 2141 ] }
58,772
NiftyToken
NiftyToken.sol
0xf08ed21ce4f49eb9a93f9af745e7beeeca6e49cc
Solidity
IERC20Metadata
interface IERC20Metadata is IERC20 { /** * @dev Returns the name of the token. */ function name() external view returns (string memory); /** * @dev Returns the symbol of the token. */ function symbol() external view returns (string memory); /** * @dev Returns the decimals places of the token. */ function decimals() external view returns (uint8); }
/** * @dev Interface for the optional metadata functions from the ERC20 standard. * * _Available since v4.1._ */
NatSpecMultiLine
name
function name() external view returns (string memory);
/** * @dev Returns the name of the token. */
NatSpecMultiLine
v0.8.2+commit.661d1103
None
ipfs://460d4208d7497d2e10a0493d70940826df3698010159966d92038dc5506103da
{ "func_code_index": [ 100, 159 ] }
58,773
NiftyToken
NiftyToken.sol
0xf08ed21ce4f49eb9a93f9af745e7beeeca6e49cc
Solidity
IERC20Metadata
interface IERC20Metadata is IERC20 { /** * @dev Returns the name of the token. */ function name() external view returns (string memory); /** * @dev Returns the symbol of the token. */ function symbol() external view returns (string memory); /** * @dev Returns the decimals places of the token. */ function decimals() external view returns (uint8); }
/** * @dev Interface for the optional metadata functions from the ERC20 standard. * * _Available since v4.1._ */
NatSpecMultiLine
symbol
function symbol() external view returns (string memory);
/** * @dev Returns the symbol of the token. */
NatSpecMultiLine
v0.8.2+commit.661d1103
None
ipfs://460d4208d7497d2e10a0493d70940826df3698010159966d92038dc5506103da
{ "func_code_index": [ 226, 287 ] }
58,774
NiftyToken
NiftyToken.sol
0xf08ed21ce4f49eb9a93f9af745e7beeeca6e49cc
Solidity
IERC20Metadata
interface IERC20Metadata is IERC20 { /** * @dev Returns the name of the token. */ function name() external view returns (string memory); /** * @dev Returns the symbol of the token. */ function symbol() external view returns (string memory); /** * @dev Returns the decimals places of the token. */ function decimals() external view returns (uint8); }
/** * @dev Interface for the optional metadata functions from the ERC20 standard. * * _Available since v4.1._ */
NatSpecMultiLine
decimals
function decimals() external view returns (uint8);
/** * @dev Returns the decimals places of the token. */
NatSpecMultiLine
v0.8.2+commit.661d1103
None
ipfs://460d4208d7497d2e10a0493d70940826df3698010159966d92038dc5506103da
{ "func_code_index": [ 363, 418 ] }
58,775
NiftyToken
NiftyToken.sol
0xf08ed21ce4f49eb9a93f9af745e7beeeca6e49cc
Solidity
ERC20
contract ERC20 is Context, IERC20, IERC20Metadata { mapping (address => uint256) private _balances; mapping (address => mapping (address => uint256)) private _allowances; uint256 private _totalSupply; string private _name; string private _symbol; /** * @dev Sets the values for {name} and {symbol}. * * The defaut value of {decimals} is 18. To select a different value for * {decimals} you should overload it. * * All two of these values are immutable: they can only be set once during * construction. */ constructor (string memory name_, string memory symbol_) { _name = name_; _symbol = symbol_; } /** * @dev Returns the name of the token. */ function name() public view virtual override returns (string memory) { return _name; } /** * @dev Returns the symbol of the token, usually a shorter version of the * name. */ function symbol() public view virtual override 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 this function is * overridden; * * 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 virtual override returns (uint8) { return 18; } /** * @dev See {IERC20-totalSupply}. */ function totalSupply() public view virtual override returns (uint256) { return _totalSupply; } /** * @dev See {IERC20-balanceOf}. */ function balanceOf(address account) public view virtual 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-allowance}. */ function allowance(address owner, address spender) public view virtual override returns (uint256) { return _allowances[owner][spender]; } /** * @dev See {IERC20-approve}. * * Requirements: * * - `spender` cannot be the zero address. */ function approve(address spender, uint256 amount) public virtual override returns (bool) { _approve(_msgSender(), spender, amount); return true; } /** * @dev See {IERC20-transferFrom}. * * Emits an {Approval} event indicating the updated allowance. This is not * required by the EIP. See the note at the beginning of {ERC20}. * * Requirements: * * - `sender` and `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. * - the caller must have allowance for ``sender``'s tokens of at least * `amount`. */ function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) { _transfer(sender, recipient, amount); uint256 currentAllowance = _allowances[sender][_msgSender()]; require(currentAllowance >= amount, "ERC20: transfer amount exceeds allowance"); _approve(sender, _msgSender(), currentAllowance - amount); return true; } /** * @dev Atomically increases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. */ function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender] + addedValue); return true; } /** * @dev Atomically decreases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. * - `spender` must have allowance for the caller of at least * `subtractedValue`. */ function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) { uint256 currentAllowance = _allowances[_msgSender()][spender]; require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero"); _approve(_msgSender(), spender, currentAllowance - subtractedValue); return true; } /** * @dev Moves tokens `amount` from `sender` to `recipient`. * * This is internal function is equivalent to {transfer}, and can be used to * e.g. implement automatic token fees, slashing mechanisms, etc. * * Emits a {Transfer} event. * * Requirements: * * - `sender` cannot be the zero address. * - `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. */ 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"); _beforeTokenTransfer(sender, recipient, amount); uint256 senderBalance = _balances[sender]; require(senderBalance >= amount, "ERC20: transfer amount exceeds balance"); _balances[sender] = senderBalance - amount; _balances[recipient] += amount; emit Transfer(sender, recipient, amount); } /** @dev Creates `amount` tokens and assigns them to `account`, increasing * the total supply. * * Emits a {Transfer} event with `from` set to the zero address. * * Requirements: * * - `to` cannot be the zero address. */ function _mint(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: mint to the zero address"); _beforeTokenTransfer(address(0), account, amount); _totalSupply += amount; _balances[account] += amount; emit Transfer(address(0), account, amount); } /** * @dev Destroys `amount` tokens from `account`, reducing the * total supply. * * Emits a {Transfer} event with `to` set to the zero address. * * Requirements: * * - `account` cannot be the zero address. * - `account` must have at least `amount` tokens. */ function _burn(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: burn from the zero address"); _beforeTokenTransfer(account, address(0), amount); uint256 accountBalance = _balances[account]; require(accountBalance >= amount, "ERC20: burn amount exceeds balance"); _balances[account] = accountBalance - amount; _totalSupply -= amount; emit Transfer(account, address(0), amount); } /** * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens. * * This internal function is equivalent to `approve`, and can be used to * e.g. set automatic allowances for certain subsystems, etc. * * Emits an {Approval} event. * * Requirements: * * - `owner` cannot be the zero address. * - `spender` cannot be the zero address. */ 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); } /** * @dev Hook that is called before any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens * will be to transferred to `to`. * - when `from` is zero, `amount` tokens will be minted for `to`. * - when `to` is zero, `amount` of ``from``'s tokens will be burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ 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 virtual override returns (string memory) { return _name; }
/** * @dev Returns the name of the token. */
NatSpecMultiLine
v0.8.2+commit.661d1103
None
ipfs://460d4208d7497d2e10a0493d70940826df3698010159966d92038dc5506103da
{ "func_code_index": [ 779, 884 ] }
58,776
NiftyToken
NiftyToken.sol
0xf08ed21ce4f49eb9a93f9af745e7beeeca6e49cc
Solidity
ERC20
contract ERC20 is Context, IERC20, IERC20Metadata { mapping (address => uint256) private _balances; mapping (address => mapping (address => uint256)) private _allowances; uint256 private _totalSupply; string private _name; string private _symbol; /** * @dev Sets the values for {name} and {symbol}. * * The defaut value of {decimals} is 18. To select a different value for * {decimals} you should overload it. * * All two of these values are immutable: they can only be set once during * construction. */ constructor (string memory name_, string memory symbol_) { _name = name_; _symbol = symbol_; } /** * @dev Returns the name of the token. */ function name() public view virtual override returns (string memory) { return _name; } /** * @dev Returns the symbol of the token, usually a shorter version of the * name. */ function symbol() public view virtual override 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 this function is * overridden; * * 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 virtual override returns (uint8) { return 18; } /** * @dev See {IERC20-totalSupply}. */ function totalSupply() public view virtual override returns (uint256) { return _totalSupply; } /** * @dev See {IERC20-balanceOf}. */ function balanceOf(address account) public view virtual 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-allowance}. */ function allowance(address owner, address spender) public view virtual override returns (uint256) { return _allowances[owner][spender]; } /** * @dev See {IERC20-approve}. * * Requirements: * * - `spender` cannot be the zero address. */ function approve(address spender, uint256 amount) public virtual override returns (bool) { _approve(_msgSender(), spender, amount); return true; } /** * @dev See {IERC20-transferFrom}. * * Emits an {Approval} event indicating the updated allowance. This is not * required by the EIP. See the note at the beginning of {ERC20}. * * Requirements: * * - `sender` and `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. * - the caller must have allowance for ``sender``'s tokens of at least * `amount`. */ function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) { _transfer(sender, recipient, amount); uint256 currentAllowance = _allowances[sender][_msgSender()]; require(currentAllowance >= amount, "ERC20: transfer amount exceeds allowance"); _approve(sender, _msgSender(), currentAllowance - amount); return true; } /** * @dev Atomically increases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. */ function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender] + addedValue); return true; } /** * @dev Atomically decreases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. * - `spender` must have allowance for the caller of at least * `subtractedValue`. */ function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) { uint256 currentAllowance = _allowances[_msgSender()][spender]; require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero"); _approve(_msgSender(), spender, currentAllowance - subtractedValue); return true; } /** * @dev Moves tokens `amount` from `sender` to `recipient`. * * This is internal function is equivalent to {transfer}, and can be used to * e.g. implement automatic token fees, slashing mechanisms, etc. * * Emits a {Transfer} event. * * Requirements: * * - `sender` cannot be the zero address. * - `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. */ 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"); _beforeTokenTransfer(sender, recipient, amount); uint256 senderBalance = _balances[sender]; require(senderBalance >= amount, "ERC20: transfer amount exceeds balance"); _balances[sender] = senderBalance - amount; _balances[recipient] += amount; emit Transfer(sender, recipient, amount); } /** @dev Creates `amount` tokens and assigns them to `account`, increasing * the total supply. * * Emits a {Transfer} event with `from` set to the zero address. * * Requirements: * * - `to` cannot be the zero address. */ function _mint(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: mint to the zero address"); _beforeTokenTransfer(address(0), account, amount); _totalSupply += amount; _balances[account] += amount; emit Transfer(address(0), account, amount); } /** * @dev Destroys `amount` tokens from `account`, reducing the * total supply. * * Emits a {Transfer} event with `to` set to the zero address. * * Requirements: * * - `account` cannot be the zero address. * - `account` must have at least `amount` tokens. */ function _burn(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: burn from the zero address"); _beforeTokenTransfer(account, address(0), amount); uint256 accountBalance = _balances[account]; require(accountBalance >= amount, "ERC20: burn amount exceeds balance"); _balances[account] = accountBalance - amount; _totalSupply -= amount; emit Transfer(account, address(0), amount); } /** * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens. * * This internal function is equivalent to `approve`, and can be used to * e.g. set automatic allowances for certain subsystems, etc. * * Emits an {Approval} event. * * Requirements: * * - `owner` cannot be the zero address. * - `spender` cannot be the zero address. */ 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); } /** * @dev Hook that is called before any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens * will be to transferred to `to`. * - when `from` is zero, `amount` tokens will be minted for `to`. * - when `to` is zero, `amount` of ``from``'s tokens will be burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ 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 virtual override returns (string memory) { return _symbol; }
/** * @dev Returns the symbol of the token, usually a shorter version of the * name. */
NatSpecMultiLine
v0.8.2+commit.661d1103
None
ipfs://460d4208d7497d2e10a0493d70940826df3698010159966d92038dc5506103da
{ "func_code_index": [ 998, 1107 ] }
58,777
NiftyToken
NiftyToken.sol
0xf08ed21ce4f49eb9a93f9af745e7beeeca6e49cc
Solidity
ERC20
contract ERC20 is Context, IERC20, IERC20Metadata { mapping (address => uint256) private _balances; mapping (address => mapping (address => uint256)) private _allowances; uint256 private _totalSupply; string private _name; string private _symbol; /** * @dev Sets the values for {name} and {symbol}. * * The defaut value of {decimals} is 18. To select a different value for * {decimals} you should overload it. * * All two of these values are immutable: they can only be set once during * construction. */ constructor (string memory name_, string memory symbol_) { _name = name_; _symbol = symbol_; } /** * @dev Returns the name of the token. */ function name() public view virtual override returns (string memory) { return _name; } /** * @dev Returns the symbol of the token, usually a shorter version of the * name. */ function symbol() public view virtual override 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 this function is * overridden; * * 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 virtual override returns (uint8) { return 18; } /** * @dev See {IERC20-totalSupply}. */ function totalSupply() public view virtual override returns (uint256) { return _totalSupply; } /** * @dev See {IERC20-balanceOf}. */ function balanceOf(address account) public view virtual 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-allowance}. */ function allowance(address owner, address spender) public view virtual override returns (uint256) { return _allowances[owner][spender]; } /** * @dev See {IERC20-approve}. * * Requirements: * * - `spender` cannot be the zero address. */ function approve(address spender, uint256 amount) public virtual override returns (bool) { _approve(_msgSender(), spender, amount); return true; } /** * @dev See {IERC20-transferFrom}. * * Emits an {Approval} event indicating the updated allowance. This is not * required by the EIP. See the note at the beginning of {ERC20}. * * Requirements: * * - `sender` and `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. * - the caller must have allowance for ``sender``'s tokens of at least * `amount`. */ function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) { _transfer(sender, recipient, amount); uint256 currentAllowance = _allowances[sender][_msgSender()]; require(currentAllowance >= amount, "ERC20: transfer amount exceeds allowance"); _approve(sender, _msgSender(), currentAllowance - amount); return true; } /** * @dev Atomically increases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. */ function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender] + addedValue); return true; } /** * @dev Atomically decreases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. * - `spender` must have allowance for the caller of at least * `subtractedValue`. */ function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) { uint256 currentAllowance = _allowances[_msgSender()][spender]; require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero"); _approve(_msgSender(), spender, currentAllowance - subtractedValue); return true; } /** * @dev Moves tokens `amount` from `sender` to `recipient`. * * This is internal function is equivalent to {transfer}, and can be used to * e.g. implement automatic token fees, slashing mechanisms, etc. * * Emits a {Transfer} event. * * Requirements: * * - `sender` cannot be the zero address. * - `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. */ 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"); _beforeTokenTransfer(sender, recipient, amount); uint256 senderBalance = _balances[sender]; require(senderBalance >= amount, "ERC20: transfer amount exceeds balance"); _balances[sender] = senderBalance - amount; _balances[recipient] += amount; emit Transfer(sender, recipient, amount); } /** @dev Creates `amount` tokens and assigns them to `account`, increasing * the total supply. * * Emits a {Transfer} event with `from` set to the zero address. * * Requirements: * * - `to` cannot be the zero address. */ function _mint(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: mint to the zero address"); _beforeTokenTransfer(address(0), account, amount); _totalSupply += amount; _balances[account] += amount; emit Transfer(address(0), account, amount); } /** * @dev Destroys `amount` tokens from `account`, reducing the * total supply. * * Emits a {Transfer} event with `to` set to the zero address. * * Requirements: * * - `account` cannot be the zero address. * - `account` must have at least `amount` tokens. */ function _burn(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: burn from the zero address"); _beforeTokenTransfer(account, address(0), amount); uint256 accountBalance = _balances[account]; require(accountBalance >= amount, "ERC20: burn amount exceeds balance"); _balances[account] = accountBalance - amount; _totalSupply -= amount; emit Transfer(account, address(0), amount); } /** * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens. * * This internal function is equivalent to `approve`, and can be used to * e.g. set automatic allowances for certain subsystems, etc. * * Emits an {Approval} event. * * Requirements: * * - `owner` cannot be the zero address. * - `spender` cannot be the zero address. */ 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); } /** * @dev Hook that is called before any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens * will be to transferred to `to`. * - when `from` is zero, `amount` tokens will be minted for `to`. * - when `to` is zero, `amount` of ``from``'s tokens will be burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ 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 virtual override returns (uint8) { return 18; }
/** * @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 this function is * overridden; * * 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.8.2+commit.661d1103
None
ipfs://460d4208d7497d2e10a0493d70940826df3698010159966d92038dc5506103da
{ "func_code_index": [ 1741, 1839 ] }
58,778
NiftyToken
NiftyToken.sol
0xf08ed21ce4f49eb9a93f9af745e7beeeca6e49cc
Solidity
ERC20
contract ERC20 is Context, IERC20, IERC20Metadata { mapping (address => uint256) private _balances; mapping (address => mapping (address => uint256)) private _allowances; uint256 private _totalSupply; string private _name; string private _symbol; /** * @dev Sets the values for {name} and {symbol}. * * The defaut value of {decimals} is 18. To select a different value for * {decimals} you should overload it. * * All two of these values are immutable: they can only be set once during * construction. */ constructor (string memory name_, string memory symbol_) { _name = name_; _symbol = symbol_; } /** * @dev Returns the name of the token. */ function name() public view virtual override returns (string memory) { return _name; } /** * @dev Returns the symbol of the token, usually a shorter version of the * name. */ function symbol() public view virtual override 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 this function is * overridden; * * 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 virtual override returns (uint8) { return 18; } /** * @dev See {IERC20-totalSupply}. */ function totalSupply() public view virtual override returns (uint256) { return _totalSupply; } /** * @dev See {IERC20-balanceOf}. */ function balanceOf(address account) public view virtual 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-allowance}. */ function allowance(address owner, address spender) public view virtual override returns (uint256) { return _allowances[owner][spender]; } /** * @dev See {IERC20-approve}. * * Requirements: * * - `spender` cannot be the zero address. */ function approve(address spender, uint256 amount) public virtual override returns (bool) { _approve(_msgSender(), spender, amount); return true; } /** * @dev See {IERC20-transferFrom}. * * Emits an {Approval} event indicating the updated allowance. This is not * required by the EIP. See the note at the beginning of {ERC20}. * * Requirements: * * - `sender` and `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. * - the caller must have allowance for ``sender``'s tokens of at least * `amount`. */ function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) { _transfer(sender, recipient, amount); uint256 currentAllowance = _allowances[sender][_msgSender()]; require(currentAllowance >= amount, "ERC20: transfer amount exceeds allowance"); _approve(sender, _msgSender(), currentAllowance - amount); return true; } /** * @dev Atomically increases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. */ function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender] + addedValue); return true; } /** * @dev Atomically decreases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. * - `spender` must have allowance for the caller of at least * `subtractedValue`. */ function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) { uint256 currentAllowance = _allowances[_msgSender()][spender]; require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero"); _approve(_msgSender(), spender, currentAllowance - subtractedValue); return true; } /** * @dev Moves tokens `amount` from `sender` to `recipient`. * * This is internal function is equivalent to {transfer}, and can be used to * e.g. implement automatic token fees, slashing mechanisms, etc. * * Emits a {Transfer} event. * * Requirements: * * - `sender` cannot be the zero address. * - `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. */ 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"); _beforeTokenTransfer(sender, recipient, amount); uint256 senderBalance = _balances[sender]; require(senderBalance >= amount, "ERC20: transfer amount exceeds balance"); _balances[sender] = senderBalance - amount; _balances[recipient] += amount; emit Transfer(sender, recipient, amount); } /** @dev Creates `amount` tokens and assigns them to `account`, increasing * the total supply. * * Emits a {Transfer} event with `from` set to the zero address. * * Requirements: * * - `to` cannot be the zero address. */ function _mint(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: mint to the zero address"); _beforeTokenTransfer(address(0), account, amount); _totalSupply += amount; _balances[account] += amount; emit Transfer(address(0), account, amount); } /** * @dev Destroys `amount` tokens from `account`, reducing the * total supply. * * Emits a {Transfer} event with `to` set to the zero address. * * Requirements: * * - `account` cannot be the zero address. * - `account` must have at least `amount` tokens. */ function _burn(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: burn from the zero address"); _beforeTokenTransfer(account, address(0), amount); uint256 accountBalance = _balances[account]; require(accountBalance >= amount, "ERC20: burn amount exceeds balance"); _balances[account] = accountBalance - amount; _totalSupply -= amount; emit Transfer(account, address(0), amount); } /** * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens. * * This internal function is equivalent to `approve`, and can be used to * e.g. set automatic allowances for certain subsystems, etc. * * Emits an {Approval} event. * * Requirements: * * - `owner` cannot be the zero address. * - `spender` cannot be the zero address. */ 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); } /** * @dev Hook that is called before any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens * will be to transferred to `to`. * - when `from` is zero, `amount` tokens will be minted for `to`. * - when `to` is zero, `amount` of ``from``'s tokens will be burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ 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 virtual override returns (uint256) { return _totalSupply; }
/** * @dev See {IERC20-totalSupply}. */
NatSpecMultiLine
v0.8.2+commit.661d1103
None
ipfs://460d4208d7497d2e10a0493d70940826df3698010159966d92038dc5506103da
{ "func_code_index": [ 1899, 2012 ] }
58,779
NiftyToken
NiftyToken.sol
0xf08ed21ce4f49eb9a93f9af745e7beeeca6e49cc
Solidity
ERC20
contract ERC20 is Context, IERC20, IERC20Metadata { mapping (address => uint256) private _balances; mapping (address => mapping (address => uint256)) private _allowances; uint256 private _totalSupply; string private _name; string private _symbol; /** * @dev Sets the values for {name} and {symbol}. * * The defaut value of {decimals} is 18. To select a different value for * {decimals} you should overload it. * * All two of these values are immutable: they can only be set once during * construction. */ constructor (string memory name_, string memory symbol_) { _name = name_; _symbol = symbol_; } /** * @dev Returns the name of the token. */ function name() public view virtual override returns (string memory) { return _name; } /** * @dev Returns the symbol of the token, usually a shorter version of the * name. */ function symbol() public view virtual override 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 this function is * overridden; * * 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 virtual override returns (uint8) { return 18; } /** * @dev See {IERC20-totalSupply}. */ function totalSupply() public view virtual override returns (uint256) { return _totalSupply; } /** * @dev See {IERC20-balanceOf}. */ function balanceOf(address account) public view virtual 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-allowance}. */ function allowance(address owner, address spender) public view virtual override returns (uint256) { return _allowances[owner][spender]; } /** * @dev See {IERC20-approve}. * * Requirements: * * - `spender` cannot be the zero address. */ function approve(address spender, uint256 amount) public virtual override returns (bool) { _approve(_msgSender(), spender, amount); return true; } /** * @dev See {IERC20-transferFrom}. * * Emits an {Approval} event indicating the updated allowance. This is not * required by the EIP. See the note at the beginning of {ERC20}. * * Requirements: * * - `sender` and `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. * - the caller must have allowance for ``sender``'s tokens of at least * `amount`. */ function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) { _transfer(sender, recipient, amount); uint256 currentAllowance = _allowances[sender][_msgSender()]; require(currentAllowance >= amount, "ERC20: transfer amount exceeds allowance"); _approve(sender, _msgSender(), currentAllowance - amount); return true; } /** * @dev Atomically increases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. */ function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender] + addedValue); return true; } /** * @dev Atomically decreases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. * - `spender` must have allowance for the caller of at least * `subtractedValue`. */ function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) { uint256 currentAllowance = _allowances[_msgSender()][spender]; require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero"); _approve(_msgSender(), spender, currentAllowance - subtractedValue); return true; } /** * @dev Moves tokens `amount` from `sender` to `recipient`. * * This is internal function is equivalent to {transfer}, and can be used to * e.g. implement automatic token fees, slashing mechanisms, etc. * * Emits a {Transfer} event. * * Requirements: * * - `sender` cannot be the zero address. * - `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. */ 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"); _beforeTokenTransfer(sender, recipient, amount); uint256 senderBalance = _balances[sender]; require(senderBalance >= amount, "ERC20: transfer amount exceeds balance"); _balances[sender] = senderBalance - amount; _balances[recipient] += amount; emit Transfer(sender, recipient, amount); } /** @dev Creates `amount` tokens and assigns them to `account`, increasing * the total supply. * * Emits a {Transfer} event with `from` set to the zero address. * * Requirements: * * - `to` cannot be the zero address. */ function _mint(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: mint to the zero address"); _beforeTokenTransfer(address(0), account, amount); _totalSupply += amount; _balances[account] += amount; emit Transfer(address(0), account, amount); } /** * @dev Destroys `amount` tokens from `account`, reducing the * total supply. * * Emits a {Transfer} event with `to` set to the zero address. * * Requirements: * * - `account` cannot be the zero address. * - `account` must have at least `amount` tokens. */ function _burn(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: burn from the zero address"); _beforeTokenTransfer(account, address(0), amount); uint256 accountBalance = _balances[account]; require(accountBalance >= amount, "ERC20: burn amount exceeds balance"); _balances[account] = accountBalance - amount; _totalSupply -= amount; emit Transfer(account, address(0), amount); } /** * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens. * * This internal function is equivalent to `approve`, and can be used to * e.g. set automatic allowances for certain subsystems, etc. * * Emits an {Approval} event. * * Requirements: * * - `owner` cannot be the zero address. * - `spender` cannot be the zero address. */ 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); } /** * @dev Hook that is called before any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens * will be to transferred to `to`. * - when `from` is zero, `amount` tokens will be minted for `to`. * - when `to` is zero, `amount` of ``from``'s tokens will be burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ 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 virtual override returns (uint256) { return _balances[account]; }
/** * @dev See {IERC20-balanceOf}. */
NatSpecMultiLine
v0.8.2+commit.661d1103
None
ipfs://460d4208d7497d2e10a0493d70940826df3698010159966d92038dc5506103da
{ "func_code_index": [ 2070, 2202 ] }
58,780
NiftyToken
NiftyToken.sol
0xf08ed21ce4f49eb9a93f9af745e7beeeca6e49cc
Solidity
ERC20
contract ERC20 is Context, IERC20, IERC20Metadata { mapping (address => uint256) private _balances; mapping (address => mapping (address => uint256)) private _allowances; uint256 private _totalSupply; string private _name; string private _symbol; /** * @dev Sets the values for {name} and {symbol}. * * The defaut value of {decimals} is 18. To select a different value for * {decimals} you should overload it. * * All two of these values are immutable: they can only be set once during * construction. */ constructor (string memory name_, string memory symbol_) { _name = name_; _symbol = symbol_; } /** * @dev Returns the name of the token. */ function name() public view virtual override returns (string memory) { return _name; } /** * @dev Returns the symbol of the token, usually a shorter version of the * name. */ function symbol() public view virtual override 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 this function is * overridden; * * 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 virtual override returns (uint8) { return 18; } /** * @dev See {IERC20-totalSupply}. */ function totalSupply() public view virtual override returns (uint256) { return _totalSupply; } /** * @dev See {IERC20-balanceOf}. */ function balanceOf(address account) public view virtual 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-allowance}. */ function allowance(address owner, address spender) public view virtual override returns (uint256) { return _allowances[owner][spender]; } /** * @dev See {IERC20-approve}. * * Requirements: * * - `spender` cannot be the zero address. */ function approve(address spender, uint256 amount) public virtual override returns (bool) { _approve(_msgSender(), spender, amount); return true; } /** * @dev See {IERC20-transferFrom}. * * Emits an {Approval} event indicating the updated allowance. This is not * required by the EIP. See the note at the beginning of {ERC20}. * * Requirements: * * - `sender` and `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. * - the caller must have allowance for ``sender``'s tokens of at least * `amount`. */ function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) { _transfer(sender, recipient, amount); uint256 currentAllowance = _allowances[sender][_msgSender()]; require(currentAllowance >= amount, "ERC20: transfer amount exceeds allowance"); _approve(sender, _msgSender(), currentAllowance - amount); return true; } /** * @dev Atomically increases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. */ function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender] + addedValue); return true; } /** * @dev Atomically decreases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. * - `spender` must have allowance for the caller of at least * `subtractedValue`. */ function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) { uint256 currentAllowance = _allowances[_msgSender()][spender]; require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero"); _approve(_msgSender(), spender, currentAllowance - subtractedValue); return true; } /** * @dev Moves tokens `amount` from `sender` to `recipient`. * * This is internal function is equivalent to {transfer}, and can be used to * e.g. implement automatic token fees, slashing mechanisms, etc. * * Emits a {Transfer} event. * * Requirements: * * - `sender` cannot be the zero address. * - `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. */ 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"); _beforeTokenTransfer(sender, recipient, amount); uint256 senderBalance = _balances[sender]; require(senderBalance >= amount, "ERC20: transfer amount exceeds balance"); _balances[sender] = senderBalance - amount; _balances[recipient] += amount; emit Transfer(sender, recipient, amount); } /** @dev Creates `amount` tokens and assigns them to `account`, increasing * the total supply. * * Emits a {Transfer} event with `from` set to the zero address. * * Requirements: * * - `to` cannot be the zero address. */ function _mint(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: mint to the zero address"); _beforeTokenTransfer(address(0), account, amount); _totalSupply += amount; _balances[account] += amount; emit Transfer(address(0), account, amount); } /** * @dev Destroys `amount` tokens from `account`, reducing the * total supply. * * Emits a {Transfer} event with `to` set to the zero address. * * Requirements: * * - `account` cannot be the zero address. * - `account` must have at least `amount` tokens. */ function _burn(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: burn from the zero address"); _beforeTokenTransfer(account, address(0), amount); uint256 accountBalance = _balances[account]; require(accountBalance >= amount, "ERC20: burn amount exceeds balance"); _balances[account] = accountBalance - amount; _totalSupply -= amount; emit Transfer(account, address(0), amount); } /** * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens. * * This internal function is equivalent to `approve`, and can be used to * e.g. set automatic allowances for certain subsystems, etc. * * Emits an {Approval} event. * * Requirements: * * - `owner` cannot be the zero address. * - `spender` cannot be the zero address. */ 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); } /** * @dev Hook that is called before any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens * will be to transferred to `to`. * - when `from` is zero, `amount` tokens will be minted for `to`. * - when `to` is zero, `amount` of ``from``'s tokens will be burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ 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.8.2+commit.661d1103
None
ipfs://460d4208d7497d2e10a0493d70940826df3698010159966d92038dc5506103da
{ "func_code_index": [ 2410, 2590 ] }
58,781
NiftyToken
NiftyToken.sol
0xf08ed21ce4f49eb9a93f9af745e7beeeca6e49cc
Solidity
ERC20
contract ERC20 is Context, IERC20, IERC20Metadata { mapping (address => uint256) private _balances; mapping (address => mapping (address => uint256)) private _allowances; uint256 private _totalSupply; string private _name; string private _symbol; /** * @dev Sets the values for {name} and {symbol}. * * The defaut value of {decimals} is 18. To select a different value for * {decimals} you should overload it. * * All two of these values are immutable: they can only be set once during * construction. */ constructor (string memory name_, string memory symbol_) { _name = name_; _symbol = symbol_; } /** * @dev Returns the name of the token. */ function name() public view virtual override returns (string memory) { return _name; } /** * @dev Returns the symbol of the token, usually a shorter version of the * name. */ function symbol() public view virtual override 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 this function is * overridden; * * 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 virtual override returns (uint8) { return 18; } /** * @dev See {IERC20-totalSupply}. */ function totalSupply() public view virtual override returns (uint256) { return _totalSupply; } /** * @dev See {IERC20-balanceOf}. */ function balanceOf(address account) public view virtual 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-allowance}. */ function allowance(address owner, address spender) public view virtual override returns (uint256) { return _allowances[owner][spender]; } /** * @dev See {IERC20-approve}. * * Requirements: * * - `spender` cannot be the zero address. */ function approve(address spender, uint256 amount) public virtual override returns (bool) { _approve(_msgSender(), spender, amount); return true; } /** * @dev See {IERC20-transferFrom}. * * Emits an {Approval} event indicating the updated allowance. This is not * required by the EIP. See the note at the beginning of {ERC20}. * * Requirements: * * - `sender` and `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. * - the caller must have allowance for ``sender``'s tokens of at least * `amount`. */ function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) { _transfer(sender, recipient, amount); uint256 currentAllowance = _allowances[sender][_msgSender()]; require(currentAllowance >= amount, "ERC20: transfer amount exceeds allowance"); _approve(sender, _msgSender(), currentAllowance - amount); return true; } /** * @dev Atomically increases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. */ function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender] + addedValue); return true; } /** * @dev Atomically decreases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. * - `spender` must have allowance for the caller of at least * `subtractedValue`. */ function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) { uint256 currentAllowance = _allowances[_msgSender()][spender]; require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero"); _approve(_msgSender(), spender, currentAllowance - subtractedValue); return true; } /** * @dev Moves tokens `amount` from `sender` to `recipient`. * * This is internal function is equivalent to {transfer}, and can be used to * e.g. implement automatic token fees, slashing mechanisms, etc. * * Emits a {Transfer} event. * * Requirements: * * - `sender` cannot be the zero address. * - `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. */ 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"); _beforeTokenTransfer(sender, recipient, amount); uint256 senderBalance = _balances[sender]; require(senderBalance >= amount, "ERC20: transfer amount exceeds balance"); _balances[sender] = senderBalance - amount; _balances[recipient] += amount; emit Transfer(sender, recipient, amount); } /** @dev Creates `amount` tokens and assigns them to `account`, increasing * the total supply. * * Emits a {Transfer} event with `from` set to the zero address. * * Requirements: * * - `to` cannot be the zero address. */ function _mint(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: mint to the zero address"); _beforeTokenTransfer(address(0), account, amount); _totalSupply += amount; _balances[account] += amount; emit Transfer(address(0), account, amount); } /** * @dev Destroys `amount` tokens from `account`, reducing the * total supply. * * Emits a {Transfer} event with `to` set to the zero address. * * Requirements: * * - `account` cannot be the zero address. * - `account` must have at least `amount` tokens. */ function _burn(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: burn from the zero address"); _beforeTokenTransfer(account, address(0), amount); uint256 accountBalance = _balances[account]; require(accountBalance >= amount, "ERC20: burn amount exceeds balance"); _balances[account] = accountBalance - amount; _totalSupply -= amount; emit Transfer(account, address(0), amount); } /** * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens. * * This internal function is equivalent to `approve`, and can be used to * e.g. set automatic allowances for certain subsystems, etc. * * Emits an {Approval} event. * * Requirements: * * - `owner` cannot be the zero address. * - `spender` cannot be the zero address. */ 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); } /** * @dev Hook that is called before any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens * will be to transferred to `to`. * - when `from` is zero, `amount` tokens will be minted for `to`. * - when `to` is zero, `amount` of ``from``'s tokens will be burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ 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
allowance
function allowance(address owner, address spender) public view virtual override returns (uint256) { return _allowances[owner][spender]; }
/** * @dev See {IERC20-allowance}. */
NatSpecMultiLine
v0.8.2+commit.661d1103
None
ipfs://460d4208d7497d2e10a0493d70940826df3698010159966d92038dc5506103da
{ "func_code_index": [ 2648, 2804 ] }
58,782
NiftyToken
NiftyToken.sol
0xf08ed21ce4f49eb9a93f9af745e7beeeca6e49cc
Solidity
ERC20
contract ERC20 is Context, IERC20, IERC20Metadata { mapping (address => uint256) private _balances; mapping (address => mapping (address => uint256)) private _allowances; uint256 private _totalSupply; string private _name; string private _symbol; /** * @dev Sets the values for {name} and {symbol}. * * The defaut value of {decimals} is 18. To select a different value for * {decimals} you should overload it. * * All two of these values are immutable: they can only be set once during * construction. */ constructor (string memory name_, string memory symbol_) { _name = name_; _symbol = symbol_; } /** * @dev Returns the name of the token. */ function name() public view virtual override returns (string memory) { return _name; } /** * @dev Returns the symbol of the token, usually a shorter version of the * name. */ function symbol() public view virtual override 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 this function is * overridden; * * 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 virtual override returns (uint8) { return 18; } /** * @dev See {IERC20-totalSupply}. */ function totalSupply() public view virtual override returns (uint256) { return _totalSupply; } /** * @dev See {IERC20-balanceOf}. */ function balanceOf(address account) public view virtual 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-allowance}. */ function allowance(address owner, address spender) public view virtual override returns (uint256) { return _allowances[owner][spender]; } /** * @dev See {IERC20-approve}. * * Requirements: * * - `spender` cannot be the zero address. */ function approve(address spender, uint256 amount) public virtual override returns (bool) { _approve(_msgSender(), spender, amount); return true; } /** * @dev See {IERC20-transferFrom}. * * Emits an {Approval} event indicating the updated allowance. This is not * required by the EIP. See the note at the beginning of {ERC20}. * * Requirements: * * - `sender` and `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. * - the caller must have allowance for ``sender``'s tokens of at least * `amount`. */ function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) { _transfer(sender, recipient, amount); uint256 currentAllowance = _allowances[sender][_msgSender()]; require(currentAllowance >= amount, "ERC20: transfer amount exceeds allowance"); _approve(sender, _msgSender(), currentAllowance - amount); return true; } /** * @dev Atomically increases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. */ function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender] + addedValue); return true; } /** * @dev Atomically decreases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. * - `spender` must have allowance for the caller of at least * `subtractedValue`. */ function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) { uint256 currentAllowance = _allowances[_msgSender()][spender]; require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero"); _approve(_msgSender(), spender, currentAllowance - subtractedValue); return true; } /** * @dev Moves tokens `amount` from `sender` to `recipient`. * * This is internal function is equivalent to {transfer}, and can be used to * e.g. implement automatic token fees, slashing mechanisms, etc. * * Emits a {Transfer} event. * * Requirements: * * - `sender` cannot be the zero address. * - `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. */ 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"); _beforeTokenTransfer(sender, recipient, amount); uint256 senderBalance = _balances[sender]; require(senderBalance >= amount, "ERC20: transfer amount exceeds balance"); _balances[sender] = senderBalance - amount; _balances[recipient] += amount; emit Transfer(sender, recipient, amount); } /** @dev Creates `amount` tokens and assigns them to `account`, increasing * the total supply. * * Emits a {Transfer} event with `from` set to the zero address. * * Requirements: * * - `to` cannot be the zero address. */ function _mint(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: mint to the zero address"); _beforeTokenTransfer(address(0), account, amount); _totalSupply += amount; _balances[account] += amount; emit Transfer(address(0), account, amount); } /** * @dev Destroys `amount` tokens from `account`, reducing the * total supply. * * Emits a {Transfer} event with `to` set to the zero address. * * Requirements: * * - `account` cannot be the zero address. * - `account` must have at least `amount` tokens. */ function _burn(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: burn from the zero address"); _beforeTokenTransfer(account, address(0), amount); uint256 accountBalance = _balances[account]; require(accountBalance >= amount, "ERC20: burn amount exceeds balance"); _balances[account] = accountBalance - amount; _totalSupply -= amount; emit Transfer(account, address(0), amount); } /** * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens. * * This internal function is equivalent to `approve`, and can be used to * e.g. set automatic allowances for certain subsystems, etc. * * Emits an {Approval} event. * * Requirements: * * - `owner` cannot be the zero address. * - `spender` cannot be the zero address. */ 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); } /** * @dev Hook that is called before any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens * will be to transferred to `to`. * - when `from` is zero, `amount` tokens will be minted for `to`. * - when `to` is zero, `amount` of ``from``'s tokens will be burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ 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
approve
function approve(address spender, uint256 amount) public virtual override returns (bool) { _approve(_msgSender(), spender, amount); return true; }
/** * @dev See {IERC20-approve}. * * Requirements: * * - `spender` cannot be the zero address. */
NatSpecMultiLine
v0.8.2+commit.661d1103
None
ipfs://460d4208d7497d2e10a0493d70940826df3698010159966d92038dc5506103da
{ "func_code_index": [ 2946, 3120 ] }
58,783
NiftyToken
NiftyToken.sol
0xf08ed21ce4f49eb9a93f9af745e7beeeca6e49cc
Solidity
ERC20
contract ERC20 is Context, IERC20, IERC20Metadata { mapping (address => uint256) private _balances; mapping (address => mapping (address => uint256)) private _allowances; uint256 private _totalSupply; string private _name; string private _symbol; /** * @dev Sets the values for {name} and {symbol}. * * The defaut value of {decimals} is 18. To select a different value for * {decimals} you should overload it. * * All two of these values are immutable: they can only be set once during * construction. */ constructor (string memory name_, string memory symbol_) { _name = name_; _symbol = symbol_; } /** * @dev Returns the name of the token. */ function name() public view virtual override returns (string memory) { return _name; } /** * @dev Returns the symbol of the token, usually a shorter version of the * name. */ function symbol() public view virtual override 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 this function is * overridden; * * 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 virtual override returns (uint8) { return 18; } /** * @dev See {IERC20-totalSupply}. */ function totalSupply() public view virtual override returns (uint256) { return _totalSupply; } /** * @dev See {IERC20-balanceOf}. */ function balanceOf(address account) public view virtual 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-allowance}. */ function allowance(address owner, address spender) public view virtual override returns (uint256) { return _allowances[owner][spender]; } /** * @dev See {IERC20-approve}. * * Requirements: * * - `spender` cannot be the zero address. */ function approve(address spender, uint256 amount) public virtual override returns (bool) { _approve(_msgSender(), spender, amount); return true; } /** * @dev See {IERC20-transferFrom}. * * Emits an {Approval} event indicating the updated allowance. This is not * required by the EIP. See the note at the beginning of {ERC20}. * * Requirements: * * - `sender` and `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. * - the caller must have allowance for ``sender``'s tokens of at least * `amount`. */ function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) { _transfer(sender, recipient, amount); uint256 currentAllowance = _allowances[sender][_msgSender()]; require(currentAllowance >= amount, "ERC20: transfer amount exceeds allowance"); _approve(sender, _msgSender(), currentAllowance - amount); return true; } /** * @dev Atomically increases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. */ function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender] + addedValue); return true; } /** * @dev Atomically decreases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. * - `spender` must have allowance for the caller of at least * `subtractedValue`. */ function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) { uint256 currentAllowance = _allowances[_msgSender()][spender]; require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero"); _approve(_msgSender(), spender, currentAllowance - subtractedValue); return true; } /** * @dev Moves tokens `amount` from `sender` to `recipient`. * * This is internal function is equivalent to {transfer}, and can be used to * e.g. implement automatic token fees, slashing mechanisms, etc. * * Emits a {Transfer} event. * * Requirements: * * - `sender` cannot be the zero address. * - `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. */ 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"); _beforeTokenTransfer(sender, recipient, amount); uint256 senderBalance = _balances[sender]; require(senderBalance >= amount, "ERC20: transfer amount exceeds balance"); _balances[sender] = senderBalance - amount; _balances[recipient] += amount; emit Transfer(sender, recipient, amount); } /** @dev Creates `amount` tokens and assigns them to `account`, increasing * the total supply. * * Emits a {Transfer} event with `from` set to the zero address. * * Requirements: * * - `to` cannot be the zero address. */ function _mint(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: mint to the zero address"); _beforeTokenTransfer(address(0), account, amount); _totalSupply += amount; _balances[account] += amount; emit Transfer(address(0), account, amount); } /** * @dev Destroys `amount` tokens from `account`, reducing the * total supply. * * Emits a {Transfer} event with `to` set to the zero address. * * Requirements: * * - `account` cannot be the zero address. * - `account` must have at least `amount` tokens. */ function _burn(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: burn from the zero address"); _beforeTokenTransfer(account, address(0), amount); uint256 accountBalance = _balances[account]; require(accountBalance >= amount, "ERC20: burn amount exceeds balance"); _balances[account] = accountBalance - amount; _totalSupply -= amount; emit Transfer(account, address(0), amount); } /** * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens. * * This internal function is equivalent to `approve`, and can be used to * e.g. set automatic allowances for certain subsystems, etc. * * Emits an {Approval} event. * * Requirements: * * - `owner` cannot be the zero address. * - `spender` cannot be the zero address. */ 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); } /** * @dev Hook that is called before any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens * will be to transferred to `to`. * - when `from` is zero, `amount` tokens will be minted for `to`. * - when `to` is zero, `amount` of ``from``'s tokens will be burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ 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
transferFrom
function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) { _transfer(sender, recipient, amount); uint256 currentAllowance = _allowances[sender][_msgSender()]; require(currentAllowance >= amount, "ERC20: transfer amount exceeds allowance"); _approve(sender, _msgSender(), currentAllowance - amount); return true; }
/** * @dev See {IERC20-transferFrom}. * * Emits an {Approval} event indicating the updated allowance. This is not * required by the EIP. See the note at the beginning of {ERC20}. * * Requirements: * * - `sender` and `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. * - the caller must have allowance for ``sender``'s tokens of at least * `amount`. */
NatSpecMultiLine
v0.8.2+commit.661d1103
None
ipfs://460d4208d7497d2e10a0493d70940826df3698010159966d92038dc5506103da
{ "func_code_index": [ 3597, 4024 ] }
58,784
NiftyToken
NiftyToken.sol
0xf08ed21ce4f49eb9a93f9af745e7beeeca6e49cc
Solidity
ERC20
contract ERC20 is Context, IERC20, IERC20Metadata { mapping (address => uint256) private _balances; mapping (address => mapping (address => uint256)) private _allowances; uint256 private _totalSupply; string private _name; string private _symbol; /** * @dev Sets the values for {name} and {symbol}. * * The defaut value of {decimals} is 18. To select a different value for * {decimals} you should overload it. * * All two of these values are immutable: they can only be set once during * construction. */ constructor (string memory name_, string memory symbol_) { _name = name_; _symbol = symbol_; } /** * @dev Returns the name of the token. */ function name() public view virtual override returns (string memory) { return _name; } /** * @dev Returns the symbol of the token, usually a shorter version of the * name. */ function symbol() public view virtual override 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 this function is * overridden; * * 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 virtual override returns (uint8) { return 18; } /** * @dev See {IERC20-totalSupply}. */ function totalSupply() public view virtual override returns (uint256) { return _totalSupply; } /** * @dev See {IERC20-balanceOf}. */ function balanceOf(address account) public view virtual 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-allowance}. */ function allowance(address owner, address spender) public view virtual override returns (uint256) { return _allowances[owner][spender]; } /** * @dev See {IERC20-approve}. * * Requirements: * * - `spender` cannot be the zero address. */ function approve(address spender, uint256 amount) public virtual override returns (bool) { _approve(_msgSender(), spender, amount); return true; } /** * @dev See {IERC20-transferFrom}. * * Emits an {Approval} event indicating the updated allowance. This is not * required by the EIP. See the note at the beginning of {ERC20}. * * Requirements: * * - `sender` and `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. * - the caller must have allowance for ``sender``'s tokens of at least * `amount`. */ function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) { _transfer(sender, recipient, amount); uint256 currentAllowance = _allowances[sender][_msgSender()]; require(currentAllowance >= amount, "ERC20: transfer amount exceeds allowance"); _approve(sender, _msgSender(), currentAllowance - amount); return true; } /** * @dev Atomically increases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. */ function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender] + addedValue); return true; } /** * @dev Atomically decreases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. * - `spender` must have allowance for the caller of at least * `subtractedValue`. */ function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) { uint256 currentAllowance = _allowances[_msgSender()][spender]; require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero"); _approve(_msgSender(), spender, currentAllowance - subtractedValue); return true; } /** * @dev Moves tokens `amount` from `sender` to `recipient`. * * This is internal function is equivalent to {transfer}, and can be used to * e.g. implement automatic token fees, slashing mechanisms, etc. * * Emits a {Transfer} event. * * Requirements: * * - `sender` cannot be the zero address. * - `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. */ 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"); _beforeTokenTransfer(sender, recipient, amount); uint256 senderBalance = _balances[sender]; require(senderBalance >= amount, "ERC20: transfer amount exceeds balance"); _balances[sender] = senderBalance - amount; _balances[recipient] += amount; emit Transfer(sender, recipient, amount); } /** @dev Creates `amount` tokens and assigns them to `account`, increasing * the total supply. * * Emits a {Transfer} event with `from` set to the zero address. * * Requirements: * * - `to` cannot be the zero address. */ function _mint(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: mint to the zero address"); _beforeTokenTransfer(address(0), account, amount); _totalSupply += amount; _balances[account] += amount; emit Transfer(address(0), account, amount); } /** * @dev Destroys `amount` tokens from `account`, reducing the * total supply. * * Emits a {Transfer} event with `to` set to the zero address. * * Requirements: * * - `account` cannot be the zero address. * - `account` must have at least `amount` tokens. */ function _burn(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: burn from the zero address"); _beforeTokenTransfer(account, address(0), amount); uint256 accountBalance = _balances[account]; require(accountBalance >= amount, "ERC20: burn amount exceeds balance"); _balances[account] = accountBalance - amount; _totalSupply -= amount; emit Transfer(account, address(0), amount); } /** * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens. * * This internal function is equivalent to `approve`, and can be used to * e.g. set automatic allowances for certain subsystems, etc. * * Emits an {Approval} event. * * Requirements: * * - `owner` cannot be the zero address. * - `spender` cannot be the zero address. */ 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); } /** * @dev Hook that is called before any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens * will be to transferred to `to`. * - when `from` is zero, `amount` tokens will be minted for `to`. * - when `to` is zero, `amount` of ``from``'s tokens will be burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ 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
increaseAllowance
function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender] + addedValue); return true; }
/** * @dev Atomically increases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. */
NatSpecMultiLine
v0.8.2+commit.661d1103
None
ipfs://460d4208d7497d2e10a0493d70940826df3698010159966d92038dc5506103da
{ "func_code_index": [ 4428, 4648 ] }
58,785
NiftyToken
NiftyToken.sol
0xf08ed21ce4f49eb9a93f9af745e7beeeca6e49cc
Solidity
ERC20
contract ERC20 is Context, IERC20, IERC20Metadata { mapping (address => uint256) private _balances; mapping (address => mapping (address => uint256)) private _allowances; uint256 private _totalSupply; string private _name; string private _symbol; /** * @dev Sets the values for {name} and {symbol}. * * The defaut value of {decimals} is 18. To select a different value for * {decimals} you should overload it. * * All two of these values are immutable: they can only be set once during * construction. */ constructor (string memory name_, string memory symbol_) { _name = name_; _symbol = symbol_; } /** * @dev Returns the name of the token. */ function name() public view virtual override returns (string memory) { return _name; } /** * @dev Returns the symbol of the token, usually a shorter version of the * name. */ function symbol() public view virtual override 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 this function is * overridden; * * 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 virtual override returns (uint8) { return 18; } /** * @dev See {IERC20-totalSupply}. */ function totalSupply() public view virtual override returns (uint256) { return _totalSupply; } /** * @dev See {IERC20-balanceOf}. */ function balanceOf(address account) public view virtual 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-allowance}. */ function allowance(address owner, address spender) public view virtual override returns (uint256) { return _allowances[owner][spender]; } /** * @dev See {IERC20-approve}. * * Requirements: * * - `spender` cannot be the zero address. */ function approve(address spender, uint256 amount) public virtual override returns (bool) { _approve(_msgSender(), spender, amount); return true; } /** * @dev See {IERC20-transferFrom}. * * Emits an {Approval} event indicating the updated allowance. This is not * required by the EIP. See the note at the beginning of {ERC20}. * * Requirements: * * - `sender` and `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. * - the caller must have allowance for ``sender``'s tokens of at least * `amount`. */ function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) { _transfer(sender, recipient, amount); uint256 currentAllowance = _allowances[sender][_msgSender()]; require(currentAllowance >= amount, "ERC20: transfer amount exceeds allowance"); _approve(sender, _msgSender(), currentAllowance - amount); return true; } /** * @dev Atomically increases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. */ function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender] + addedValue); return true; } /** * @dev Atomically decreases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. * - `spender` must have allowance for the caller of at least * `subtractedValue`. */ function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) { uint256 currentAllowance = _allowances[_msgSender()][spender]; require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero"); _approve(_msgSender(), spender, currentAllowance - subtractedValue); return true; } /** * @dev Moves tokens `amount` from `sender` to `recipient`. * * This is internal function is equivalent to {transfer}, and can be used to * e.g. implement automatic token fees, slashing mechanisms, etc. * * Emits a {Transfer} event. * * Requirements: * * - `sender` cannot be the zero address. * - `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. */ 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"); _beforeTokenTransfer(sender, recipient, amount); uint256 senderBalance = _balances[sender]; require(senderBalance >= amount, "ERC20: transfer amount exceeds balance"); _balances[sender] = senderBalance - amount; _balances[recipient] += amount; emit Transfer(sender, recipient, amount); } /** @dev Creates `amount` tokens and assigns them to `account`, increasing * the total supply. * * Emits a {Transfer} event with `from` set to the zero address. * * Requirements: * * - `to` cannot be the zero address. */ function _mint(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: mint to the zero address"); _beforeTokenTransfer(address(0), account, amount); _totalSupply += amount; _balances[account] += amount; emit Transfer(address(0), account, amount); } /** * @dev Destroys `amount` tokens from `account`, reducing the * total supply. * * Emits a {Transfer} event with `to` set to the zero address. * * Requirements: * * - `account` cannot be the zero address. * - `account` must have at least `amount` tokens. */ function _burn(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: burn from the zero address"); _beforeTokenTransfer(account, address(0), amount); uint256 accountBalance = _balances[account]; require(accountBalance >= amount, "ERC20: burn amount exceeds balance"); _balances[account] = accountBalance - amount; _totalSupply -= amount; emit Transfer(account, address(0), amount); } /** * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens. * * This internal function is equivalent to `approve`, and can be used to * e.g. set automatic allowances for certain subsystems, etc. * * Emits an {Approval} event. * * Requirements: * * - `owner` cannot be the zero address. * - `spender` cannot be the zero address. */ 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); } /** * @dev Hook that is called before any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens * will be to transferred to `to`. * - when `from` is zero, `amount` tokens will be minted for `to`. * - when `to` is zero, `amount` of ``from``'s tokens will be burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ 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
decreaseAllowance
function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) { uint256 currentAllowance = _allowances[_msgSender()][spender]; require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero"); _approve(_msgSender(), spender, currentAllowance - subtractedValue); return true; }
/** * @dev Atomically decreases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. * - `spender` must have allowance for the caller of at least * `subtractedValue`. */
NatSpecMultiLine
v0.8.2+commit.661d1103
None
ipfs://460d4208d7497d2e10a0493d70940826df3698010159966d92038dc5506103da
{ "func_code_index": [ 5146, 5528 ] }
58,786
NiftyToken
NiftyToken.sol
0xf08ed21ce4f49eb9a93f9af745e7beeeca6e49cc
Solidity
ERC20
contract ERC20 is Context, IERC20, IERC20Metadata { mapping (address => uint256) private _balances; mapping (address => mapping (address => uint256)) private _allowances; uint256 private _totalSupply; string private _name; string private _symbol; /** * @dev Sets the values for {name} and {symbol}. * * The defaut value of {decimals} is 18. To select a different value for * {decimals} you should overload it. * * All two of these values are immutable: they can only be set once during * construction. */ constructor (string memory name_, string memory symbol_) { _name = name_; _symbol = symbol_; } /** * @dev Returns the name of the token. */ function name() public view virtual override returns (string memory) { return _name; } /** * @dev Returns the symbol of the token, usually a shorter version of the * name. */ function symbol() public view virtual override 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 this function is * overridden; * * 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 virtual override returns (uint8) { return 18; } /** * @dev See {IERC20-totalSupply}. */ function totalSupply() public view virtual override returns (uint256) { return _totalSupply; } /** * @dev See {IERC20-balanceOf}. */ function balanceOf(address account) public view virtual 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-allowance}. */ function allowance(address owner, address spender) public view virtual override returns (uint256) { return _allowances[owner][spender]; } /** * @dev See {IERC20-approve}. * * Requirements: * * - `spender` cannot be the zero address. */ function approve(address spender, uint256 amount) public virtual override returns (bool) { _approve(_msgSender(), spender, amount); return true; } /** * @dev See {IERC20-transferFrom}. * * Emits an {Approval} event indicating the updated allowance. This is not * required by the EIP. See the note at the beginning of {ERC20}. * * Requirements: * * - `sender` and `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. * - the caller must have allowance for ``sender``'s tokens of at least * `amount`. */ function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) { _transfer(sender, recipient, amount); uint256 currentAllowance = _allowances[sender][_msgSender()]; require(currentAllowance >= amount, "ERC20: transfer amount exceeds allowance"); _approve(sender, _msgSender(), currentAllowance - amount); return true; } /** * @dev Atomically increases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. */ function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender] + addedValue); return true; } /** * @dev Atomically decreases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. * - `spender` must have allowance for the caller of at least * `subtractedValue`. */ function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) { uint256 currentAllowance = _allowances[_msgSender()][spender]; require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero"); _approve(_msgSender(), spender, currentAllowance - subtractedValue); return true; } /** * @dev Moves tokens `amount` from `sender` to `recipient`. * * This is internal function is equivalent to {transfer}, and can be used to * e.g. implement automatic token fees, slashing mechanisms, etc. * * Emits a {Transfer} event. * * Requirements: * * - `sender` cannot be the zero address. * - `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. */ 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"); _beforeTokenTransfer(sender, recipient, amount); uint256 senderBalance = _balances[sender]; require(senderBalance >= amount, "ERC20: transfer amount exceeds balance"); _balances[sender] = senderBalance - amount; _balances[recipient] += amount; emit Transfer(sender, recipient, amount); } /** @dev Creates `amount` tokens and assigns them to `account`, increasing * the total supply. * * Emits a {Transfer} event with `from` set to the zero address. * * Requirements: * * - `to` cannot be the zero address. */ function _mint(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: mint to the zero address"); _beforeTokenTransfer(address(0), account, amount); _totalSupply += amount; _balances[account] += amount; emit Transfer(address(0), account, amount); } /** * @dev Destroys `amount` tokens from `account`, reducing the * total supply. * * Emits a {Transfer} event with `to` set to the zero address. * * Requirements: * * - `account` cannot be the zero address. * - `account` must have at least `amount` tokens. */ function _burn(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: burn from the zero address"); _beforeTokenTransfer(account, address(0), amount); uint256 accountBalance = _balances[account]; require(accountBalance >= amount, "ERC20: burn amount exceeds balance"); _balances[account] = accountBalance - amount; _totalSupply -= amount; emit Transfer(account, address(0), amount); } /** * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens. * * This internal function is equivalent to `approve`, and can be used to * e.g. set automatic allowances for certain subsystems, etc. * * Emits an {Approval} event. * * Requirements: * * - `owner` cannot be the zero address. * - `spender` cannot be the zero address. */ 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); } /** * @dev Hook that is called before any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens * will be to transferred to `to`. * - when `from` is zero, `amount` tokens will be minted for `to`. * - when `to` is zero, `amount` of ``from``'s tokens will be burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ 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 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"); _beforeTokenTransfer(sender, recipient, amount); uint256 senderBalance = _balances[sender]; require(senderBalance >= amount, "ERC20: transfer amount exceeds balance"); _balances[sender] = senderBalance - amount; _balances[recipient] += amount; emit Transfer(sender, recipient, amount); }
/** * @dev Moves tokens `amount` from `sender` to `recipient`. * * This is internal function is equivalent to {transfer}, and can be used to * e.g. implement automatic token fees, slashing mechanisms, etc. * * Emits a {Transfer} event. * * Requirements: * * - `sender` cannot be the zero address. * - `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. */
NatSpecMultiLine
v0.8.2+commit.661d1103
None
ipfs://460d4208d7497d2e10a0493d70940826df3698010159966d92038dc5506103da
{ "func_code_index": [ 6013, 6622 ] }
58,787
NiftyToken
NiftyToken.sol
0xf08ed21ce4f49eb9a93f9af745e7beeeca6e49cc
Solidity
ERC20
contract ERC20 is Context, IERC20, IERC20Metadata { mapping (address => uint256) private _balances; mapping (address => mapping (address => uint256)) private _allowances; uint256 private _totalSupply; string private _name; string private _symbol; /** * @dev Sets the values for {name} and {symbol}. * * The defaut value of {decimals} is 18. To select a different value for * {decimals} you should overload it. * * All two of these values are immutable: they can only be set once during * construction. */ constructor (string memory name_, string memory symbol_) { _name = name_; _symbol = symbol_; } /** * @dev Returns the name of the token. */ function name() public view virtual override returns (string memory) { return _name; } /** * @dev Returns the symbol of the token, usually a shorter version of the * name. */ function symbol() public view virtual override 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 this function is * overridden; * * 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 virtual override returns (uint8) { return 18; } /** * @dev See {IERC20-totalSupply}. */ function totalSupply() public view virtual override returns (uint256) { return _totalSupply; } /** * @dev See {IERC20-balanceOf}. */ function balanceOf(address account) public view virtual 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-allowance}. */ function allowance(address owner, address spender) public view virtual override returns (uint256) { return _allowances[owner][spender]; } /** * @dev See {IERC20-approve}. * * Requirements: * * - `spender` cannot be the zero address. */ function approve(address spender, uint256 amount) public virtual override returns (bool) { _approve(_msgSender(), spender, amount); return true; } /** * @dev See {IERC20-transferFrom}. * * Emits an {Approval} event indicating the updated allowance. This is not * required by the EIP. See the note at the beginning of {ERC20}. * * Requirements: * * - `sender` and `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. * - the caller must have allowance for ``sender``'s tokens of at least * `amount`. */ function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) { _transfer(sender, recipient, amount); uint256 currentAllowance = _allowances[sender][_msgSender()]; require(currentAllowance >= amount, "ERC20: transfer amount exceeds allowance"); _approve(sender, _msgSender(), currentAllowance - amount); return true; } /** * @dev Atomically increases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. */ function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender] + addedValue); return true; } /** * @dev Atomically decreases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. * - `spender` must have allowance for the caller of at least * `subtractedValue`. */ function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) { uint256 currentAllowance = _allowances[_msgSender()][spender]; require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero"); _approve(_msgSender(), spender, currentAllowance - subtractedValue); return true; } /** * @dev Moves tokens `amount` from `sender` to `recipient`. * * This is internal function is equivalent to {transfer}, and can be used to * e.g. implement automatic token fees, slashing mechanisms, etc. * * Emits a {Transfer} event. * * Requirements: * * - `sender` cannot be the zero address. * - `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. */ 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"); _beforeTokenTransfer(sender, recipient, amount); uint256 senderBalance = _balances[sender]; require(senderBalance >= amount, "ERC20: transfer amount exceeds balance"); _balances[sender] = senderBalance - amount; _balances[recipient] += amount; emit Transfer(sender, recipient, amount); } /** @dev Creates `amount` tokens and assigns them to `account`, increasing * the total supply. * * Emits a {Transfer} event with `from` set to the zero address. * * Requirements: * * - `to` cannot be the zero address. */ function _mint(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: mint to the zero address"); _beforeTokenTransfer(address(0), account, amount); _totalSupply += amount; _balances[account] += amount; emit Transfer(address(0), account, amount); } /** * @dev Destroys `amount` tokens from `account`, reducing the * total supply. * * Emits a {Transfer} event with `to` set to the zero address. * * Requirements: * * - `account` cannot be the zero address. * - `account` must have at least `amount` tokens. */ function _burn(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: burn from the zero address"); _beforeTokenTransfer(account, address(0), amount); uint256 accountBalance = _balances[account]; require(accountBalance >= amount, "ERC20: burn amount exceeds balance"); _balances[account] = accountBalance - amount; _totalSupply -= amount; emit Transfer(account, address(0), amount); } /** * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens. * * This internal function is equivalent to `approve`, and can be used to * e.g. set automatic allowances for certain subsystems, etc. * * Emits an {Approval} event. * * Requirements: * * - `owner` cannot be the zero address. * - `spender` cannot be the zero address. */ 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); } /** * @dev Hook that is called before any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens * will be to transferred to `to`. * - when `from` is zero, `amount` tokens will be minted for `to`. * - when `to` is zero, `amount` of ``from``'s tokens will be burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ 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
_mint
function _mint(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: mint to the zero address"); _beforeTokenTransfer(address(0), account, amount); _totalSupply += amount; _balances[account] += amount; emit Transfer(address(0), account, amount); }
/** @dev Creates `amount` tokens and assigns them to `account`, increasing * the total supply. * * Emits a {Transfer} event with `from` set to the zero address. * * Requirements: * * - `to` cannot be the zero address. */
NatSpecMultiLine
v0.8.2+commit.661d1103
None
ipfs://460d4208d7497d2e10a0493d70940826df3698010159966d92038dc5506103da
{ "func_code_index": [ 6899, 7242 ] }
58,788
NiftyToken
NiftyToken.sol
0xf08ed21ce4f49eb9a93f9af745e7beeeca6e49cc
Solidity
ERC20
contract ERC20 is Context, IERC20, IERC20Metadata { mapping (address => uint256) private _balances; mapping (address => mapping (address => uint256)) private _allowances; uint256 private _totalSupply; string private _name; string private _symbol; /** * @dev Sets the values for {name} and {symbol}. * * The defaut value of {decimals} is 18. To select a different value for * {decimals} you should overload it. * * All two of these values are immutable: they can only be set once during * construction. */ constructor (string memory name_, string memory symbol_) { _name = name_; _symbol = symbol_; } /** * @dev Returns the name of the token. */ function name() public view virtual override returns (string memory) { return _name; } /** * @dev Returns the symbol of the token, usually a shorter version of the * name. */ function symbol() public view virtual override 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 this function is * overridden; * * 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 virtual override returns (uint8) { return 18; } /** * @dev See {IERC20-totalSupply}. */ function totalSupply() public view virtual override returns (uint256) { return _totalSupply; } /** * @dev See {IERC20-balanceOf}. */ function balanceOf(address account) public view virtual 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-allowance}. */ function allowance(address owner, address spender) public view virtual override returns (uint256) { return _allowances[owner][spender]; } /** * @dev See {IERC20-approve}. * * Requirements: * * - `spender` cannot be the zero address. */ function approve(address spender, uint256 amount) public virtual override returns (bool) { _approve(_msgSender(), spender, amount); return true; } /** * @dev See {IERC20-transferFrom}. * * Emits an {Approval} event indicating the updated allowance. This is not * required by the EIP. See the note at the beginning of {ERC20}. * * Requirements: * * - `sender` and `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. * - the caller must have allowance for ``sender``'s tokens of at least * `amount`. */ function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) { _transfer(sender, recipient, amount); uint256 currentAllowance = _allowances[sender][_msgSender()]; require(currentAllowance >= amount, "ERC20: transfer amount exceeds allowance"); _approve(sender, _msgSender(), currentAllowance - amount); return true; } /** * @dev Atomically increases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. */ function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender] + addedValue); return true; } /** * @dev Atomically decreases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. * - `spender` must have allowance for the caller of at least * `subtractedValue`. */ function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) { uint256 currentAllowance = _allowances[_msgSender()][spender]; require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero"); _approve(_msgSender(), spender, currentAllowance - subtractedValue); return true; } /** * @dev Moves tokens `amount` from `sender` to `recipient`. * * This is internal function is equivalent to {transfer}, and can be used to * e.g. implement automatic token fees, slashing mechanisms, etc. * * Emits a {Transfer} event. * * Requirements: * * - `sender` cannot be the zero address. * - `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. */ 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"); _beforeTokenTransfer(sender, recipient, amount); uint256 senderBalance = _balances[sender]; require(senderBalance >= amount, "ERC20: transfer amount exceeds balance"); _balances[sender] = senderBalance - amount; _balances[recipient] += amount; emit Transfer(sender, recipient, amount); } /** @dev Creates `amount` tokens and assigns them to `account`, increasing * the total supply. * * Emits a {Transfer} event with `from` set to the zero address. * * Requirements: * * - `to` cannot be the zero address. */ function _mint(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: mint to the zero address"); _beforeTokenTransfer(address(0), account, amount); _totalSupply += amount; _balances[account] += amount; emit Transfer(address(0), account, amount); } /** * @dev Destroys `amount` tokens from `account`, reducing the * total supply. * * Emits a {Transfer} event with `to` set to the zero address. * * Requirements: * * - `account` cannot be the zero address. * - `account` must have at least `amount` tokens. */ function _burn(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: burn from the zero address"); _beforeTokenTransfer(account, address(0), amount); uint256 accountBalance = _balances[account]; require(accountBalance >= amount, "ERC20: burn amount exceeds balance"); _balances[account] = accountBalance - amount; _totalSupply -= amount; emit Transfer(account, address(0), amount); } /** * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens. * * This internal function is equivalent to `approve`, and can be used to * e.g. set automatic allowances for certain subsystems, etc. * * Emits an {Approval} event. * * Requirements: * * - `owner` cannot be the zero address. * - `spender` cannot be the zero address. */ 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); } /** * @dev Hook that is called before any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens * will be to transferred to `to`. * - when `from` is zero, `amount` tokens will be minted for `to`. * - when `to` is zero, `amount` of ``from``'s tokens will be burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ 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(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: burn from the zero address"); _beforeTokenTransfer(account, address(0), amount); uint256 accountBalance = _balances[account]; require(accountBalance >= amount, "ERC20: burn amount exceeds balance"); _balances[account] = accountBalance - amount; _totalSupply -= amount; emit Transfer(account, address(0), amount); }
/** * @dev Destroys `amount` tokens from `account`, reducing the * total supply. * * Emits a {Transfer} event with `to` set to the zero address. * * Requirements: * * - `account` cannot be the zero address. * - `account` must have at least `amount` tokens. */
NatSpecMultiLine
v0.8.2+commit.661d1103
None
ipfs://460d4208d7497d2e10a0493d70940826df3698010159966d92038dc5506103da
{ "func_code_index": [ 7570, 8069 ] }
58,789
NiftyToken
NiftyToken.sol
0xf08ed21ce4f49eb9a93f9af745e7beeeca6e49cc
Solidity
ERC20
contract ERC20 is Context, IERC20, IERC20Metadata { mapping (address => uint256) private _balances; mapping (address => mapping (address => uint256)) private _allowances; uint256 private _totalSupply; string private _name; string private _symbol; /** * @dev Sets the values for {name} and {symbol}. * * The defaut value of {decimals} is 18. To select a different value for * {decimals} you should overload it. * * All two of these values are immutable: they can only be set once during * construction. */ constructor (string memory name_, string memory symbol_) { _name = name_; _symbol = symbol_; } /** * @dev Returns the name of the token. */ function name() public view virtual override returns (string memory) { return _name; } /** * @dev Returns the symbol of the token, usually a shorter version of the * name. */ function symbol() public view virtual override 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 this function is * overridden; * * 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 virtual override returns (uint8) { return 18; } /** * @dev See {IERC20-totalSupply}. */ function totalSupply() public view virtual override returns (uint256) { return _totalSupply; } /** * @dev See {IERC20-balanceOf}. */ function balanceOf(address account) public view virtual 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-allowance}. */ function allowance(address owner, address spender) public view virtual override returns (uint256) { return _allowances[owner][spender]; } /** * @dev See {IERC20-approve}. * * Requirements: * * - `spender` cannot be the zero address. */ function approve(address spender, uint256 amount) public virtual override returns (bool) { _approve(_msgSender(), spender, amount); return true; } /** * @dev See {IERC20-transferFrom}. * * Emits an {Approval} event indicating the updated allowance. This is not * required by the EIP. See the note at the beginning of {ERC20}. * * Requirements: * * - `sender` and `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. * - the caller must have allowance for ``sender``'s tokens of at least * `amount`. */ function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) { _transfer(sender, recipient, amount); uint256 currentAllowance = _allowances[sender][_msgSender()]; require(currentAllowance >= amount, "ERC20: transfer amount exceeds allowance"); _approve(sender, _msgSender(), currentAllowance - amount); return true; } /** * @dev Atomically increases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. */ function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender] + addedValue); return true; } /** * @dev Atomically decreases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. * - `spender` must have allowance for the caller of at least * `subtractedValue`. */ function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) { uint256 currentAllowance = _allowances[_msgSender()][spender]; require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero"); _approve(_msgSender(), spender, currentAllowance - subtractedValue); return true; } /** * @dev Moves tokens `amount` from `sender` to `recipient`. * * This is internal function is equivalent to {transfer}, and can be used to * e.g. implement automatic token fees, slashing mechanisms, etc. * * Emits a {Transfer} event. * * Requirements: * * - `sender` cannot be the zero address. * - `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. */ 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"); _beforeTokenTransfer(sender, recipient, amount); uint256 senderBalance = _balances[sender]; require(senderBalance >= amount, "ERC20: transfer amount exceeds balance"); _balances[sender] = senderBalance - amount; _balances[recipient] += amount; emit Transfer(sender, recipient, amount); } /** @dev Creates `amount` tokens and assigns them to `account`, increasing * the total supply. * * Emits a {Transfer} event with `from` set to the zero address. * * Requirements: * * - `to` cannot be the zero address. */ function _mint(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: mint to the zero address"); _beforeTokenTransfer(address(0), account, amount); _totalSupply += amount; _balances[account] += amount; emit Transfer(address(0), account, amount); } /** * @dev Destroys `amount` tokens from `account`, reducing the * total supply. * * Emits a {Transfer} event with `to` set to the zero address. * * Requirements: * * - `account` cannot be the zero address. * - `account` must have at least `amount` tokens. */ function _burn(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: burn from the zero address"); _beforeTokenTransfer(account, address(0), amount); uint256 accountBalance = _balances[account]; require(accountBalance >= amount, "ERC20: burn amount exceeds balance"); _balances[account] = accountBalance - amount; _totalSupply -= amount; emit Transfer(account, address(0), amount); } /** * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens. * * This internal function is equivalent to `approve`, and can be used to * e.g. set automatic allowances for certain subsystems, etc. * * Emits an {Approval} event. * * Requirements: * * - `owner` cannot be the zero address. * - `spender` cannot be the zero address. */ 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); } /** * @dev Hook that is called before any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens * will be to transferred to `to`. * - when `from` is zero, `amount` tokens will be minted for `to`. * - when `to` is zero, `amount` of ``from``'s tokens will be burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ 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
_approve
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); }
/** * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens. * * This internal function is equivalent to `approve`, and can be used to * e.g. set automatic allowances for certain subsystems, etc. * * Emits an {Approval} event. * * Requirements: * * - `owner` cannot be the zero address. * - `spender` cannot be the zero address. */
NatSpecMultiLine
v0.8.2+commit.661d1103
None
ipfs://460d4208d7497d2e10a0493d70940826df3698010159966d92038dc5506103da
{ "func_code_index": [ 8502, 8853 ] }
58,790
NiftyToken
NiftyToken.sol
0xf08ed21ce4f49eb9a93f9af745e7beeeca6e49cc
Solidity
ERC20
contract ERC20 is Context, IERC20, IERC20Metadata { mapping (address => uint256) private _balances; mapping (address => mapping (address => uint256)) private _allowances; uint256 private _totalSupply; string private _name; string private _symbol; /** * @dev Sets the values for {name} and {symbol}. * * The defaut value of {decimals} is 18. To select a different value for * {decimals} you should overload it. * * All two of these values are immutable: they can only be set once during * construction. */ constructor (string memory name_, string memory symbol_) { _name = name_; _symbol = symbol_; } /** * @dev Returns the name of the token. */ function name() public view virtual override returns (string memory) { return _name; } /** * @dev Returns the symbol of the token, usually a shorter version of the * name. */ function symbol() public view virtual override 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 this function is * overridden; * * 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 virtual override returns (uint8) { return 18; } /** * @dev See {IERC20-totalSupply}. */ function totalSupply() public view virtual override returns (uint256) { return _totalSupply; } /** * @dev See {IERC20-balanceOf}. */ function balanceOf(address account) public view virtual 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-allowance}. */ function allowance(address owner, address spender) public view virtual override returns (uint256) { return _allowances[owner][spender]; } /** * @dev See {IERC20-approve}. * * Requirements: * * - `spender` cannot be the zero address. */ function approve(address spender, uint256 amount) public virtual override returns (bool) { _approve(_msgSender(), spender, amount); return true; } /** * @dev See {IERC20-transferFrom}. * * Emits an {Approval} event indicating the updated allowance. This is not * required by the EIP. See the note at the beginning of {ERC20}. * * Requirements: * * - `sender` and `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. * - the caller must have allowance for ``sender``'s tokens of at least * `amount`. */ function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) { _transfer(sender, recipient, amount); uint256 currentAllowance = _allowances[sender][_msgSender()]; require(currentAllowance >= amount, "ERC20: transfer amount exceeds allowance"); _approve(sender, _msgSender(), currentAllowance - amount); return true; } /** * @dev Atomically increases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. */ function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender] + addedValue); return true; } /** * @dev Atomically decreases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. * - `spender` must have allowance for the caller of at least * `subtractedValue`. */ function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) { uint256 currentAllowance = _allowances[_msgSender()][spender]; require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero"); _approve(_msgSender(), spender, currentAllowance - subtractedValue); return true; } /** * @dev Moves tokens `amount` from `sender` to `recipient`. * * This is internal function is equivalent to {transfer}, and can be used to * e.g. implement automatic token fees, slashing mechanisms, etc. * * Emits a {Transfer} event. * * Requirements: * * - `sender` cannot be the zero address. * - `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. */ 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"); _beforeTokenTransfer(sender, recipient, amount); uint256 senderBalance = _balances[sender]; require(senderBalance >= amount, "ERC20: transfer amount exceeds balance"); _balances[sender] = senderBalance - amount; _balances[recipient] += amount; emit Transfer(sender, recipient, amount); } /** @dev Creates `amount` tokens and assigns them to `account`, increasing * the total supply. * * Emits a {Transfer} event with `from` set to the zero address. * * Requirements: * * - `to` cannot be the zero address. */ function _mint(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: mint to the zero address"); _beforeTokenTransfer(address(0), account, amount); _totalSupply += amount; _balances[account] += amount; emit Transfer(address(0), account, amount); } /** * @dev Destroys `amount` tokens from `account`, reducing the * total supply. * * Emits a {Transfer} event with `to` set to the zero address. * * Requirements: * * - `account` cannot be the zero address. * - `account` must have at least `amount` tokens. */ function _burn(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: burn from the zero address"); _beforeTokenTransfer(account, address(0), amount); uint256 accountBalance = _balances[account]; require(accountBalance >= amount, "ERC20: burn amount exceeds balance"); _balances[account] = accountBalance - amount; _totalSupply -= amount; emit Transfer(account, address(0), amount); } /** * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens. * * This internal function is equivalent to `approve`, and can be used to * e.g. set automatic allowances for certain subsystems, etc. * * Emits an {Approval} event. * * Requirements: * * - `owner` cannot be the zero address. * - `spender` cannot be the zero address. */ 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); } /** * @dev Hook that is called before any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens * will be to transferred to `to`. * - when `from` is zero, `amount` tokens will be minted for `to`. * - when `to` is zero, `amount` of ``from``'s tokens will be burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ 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
_beforeTokenTransfer
function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual { }
/** * @dev Hook that is called before any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens * will be to transferred to `to`. * - when `from` is zero, `amount` tokens will be minted for `to`. * - when `to` is zero, `amount` of ``from``'s tokens will be burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */
NatSpecMultiLine
v0.8.2+commit.661d1103
None
ipfs://460d4208d7497d2e10a0493d70940826df3698010159966d92038dc5506103da
{ "func_code_index": [ 9451, 9548 ] }
58,791
PROGE
PROGE.sol
0x149fdd2436bb835460277422c7bf17f3b57cffc0
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); }
totalSupply
function totalSupply() external view returns (uint256);
/** * @dev Returns the amount of tokens in existence. */
NatSpecMultiLine
v0.8.1+commit.df193b15
Unlicense
ipfs://d83e49de1cb60e18b1c0fe135960a118ca85dcf6ebe951cae0c96557753d869a
{ "func_code_index": [ 94, 154 ] }
58,792
PROGE
PROGE.sol
0x149fdd2436bb835460277422c7bf17f3b57cffc0
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); }
balanceOf
function balanceOf(address account) external view returns (uint256);
/** * @dev Returns the amount of tokens owned by `account`. */
NatSpecMultiLine
v0.8.1+commit.df193b15
Unlicense
ipfs://d83e49de1cb60e18b1c0fe135960a118ca85dcf6ebe951cae0c96557753d869a
{ "func_code_index": [ 237, 310 ] }
58,793
PROGE
PROGE.sol
0x149fdd2436bb835460277422c7bf17f3b57cffc0
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); }
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.8.1+commit.df193b15
Unlicense
ipfs://d83e49de1cb60e18b1c0fe135960a118ca85dcf6ebe951cae0c96557753d869a
{ "func_code_index": [ 534, 616 ] }
58,794
PROGE
PROGE.sol
0x149fdd2436bb835460277422c7bf17f3b57cffc0
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); }
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.8.1+commit.df193b15
Unlicense
ipfs://d83e49de1cb60e18b1c0fe135960a118ca85dcf6ebe951cae0c96557753d869a
{ "func_code_index": [ 895, 983 ] }
58,795
PROGE
PROGE.sol
0x149fdd2436bb835460277422c7bf17f3b57cffc0
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); }
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.8.1+commit.df193b15
Unlicense
ipfs://d83e49de1cb60e18b1c0fe135960a118ca85dcf6ebe951cae0c96557753d869a
{ "func_code_index": [ 1647, 1726 ] }
58,796
PROGE
PROGE.sol
0x149fdd2436bb835460277422c7bf17f3b57cffc0
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); }
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.8.1+commit.df193b15
Unlicense
ipfs://d83e49de1cb60e18b1c0fe135960a118ca85dcf6ebe951cae0c96557753d869a
{ "func_code_index": [ 2039, 2141 ] }
58,797
PROGE
PROGE.sol
0x149fdd2436bb835460277422c7bf17f3b57cffc0
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; } }
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.8.1+commit.df193b15
Unlicense
ipfs://d83e49de1cb60e18b1c0fe135960a118ca85dcf6ebe951cae0c96557753d869a
{ "func_code_index": [ 259, 445 ] }
58,798
PROGE
PROGE.sol
0x149fdd2436bb835460277422c7bf17f3b57cffc0
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; } }
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.8.1+commit.df193b15
Unlicense
ipfs://d83e49de1cb60e18b1c0fe135960a118ca85dcf6ebe951cae0c96557753d869a
{ "func_code_index": [ 723, 864 ] }
58,799
PROGE
PROGE.sol
0x149fdd2436bb835460277422c7bf17f3b57cffc0
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; } }
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.8.1+commit.df193b15
Unlicense
ipfs://d83e49de1cb60e18b1c0fe135960a118ca85dcf6ebe951cae0c96557753d869a
{ "func_code_index": [ 1162, 1359 ] }
58,800
PROGE
PROGE.sol
0x149fdd2436bb835460277422c7bf17f3b57cffc0
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; } }
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.8.1+commit.df193b15
Unlicense
ipfs://d83e49de1cb60e18b1c0fe135960a118ca85dcf6ebe951cae0c96557753d869a
{ "func_code_index": [ 1613, 2089 ] }
58,801
PROGE
PROGE.sol
0x149fdd2436bb835460277422c7bf17f3b57cffc0
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; } }
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.8.1+commit.df193b15
Unlicense
ipfs://d83e49de1cb60e18b1c0fe135960a118ca85dcf6ebe951cae0c96557753d869a
{ "func_code_index": [ 2560, 2697 ] }
58,802
PROGE
PROGE.sol
0x149fdd2436bb835460277422c7bf17f3b57cffc0
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; } }
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.8.1+commit.df193b15
Unlicense
ipfs://d83e49de1cb60e18b1c0fe135960a118ca85dcf6ebe951cae0c96557753d869a
{ "func_code_index": [ 3188, 3471 ] }
58,803
PROGE
PROGE.sol
0x149fdd2436bb835460277422c7bf17f3b57cffc0
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; } }
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.8.1+commit.df193b15
Unlicense
ipfs://d83e49de1cb60e18b1c0fe135960a118ca85dcf6ebe951cae0c96557753d869a
{ "func_code_index": [ 3931, 4066 ] }
58,804
PROGE
PROGE.sol
0x149fdd2436bb835460277422c7bf17f3b57cffc0
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; } }
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.8.1+commit.df193b15
Unlicense
ipfs://d83e49de1cb60e18b1c0fe135960a118ca85dcf6ebe951cae0c96557753d869a
{ "func_code_index": [ 4546, 4717 ] }
58,805
PROGE
PROGE.sol
0x149fdd2436bb835460277422c7bf17f3b57cffc0
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); } } } }
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.8.1+commit.df193b15
Unlicense
ipfs://d83e49de1cb60e18b1c0fe135960a118ca85dcf6ebe951cae0c96557753d869a
{ "func_code_index": [ 606, 1230 ] }
58,806
PROGE
PROGE.sol
0x149fdd2436bb835460277422c7bf17f3b57cffc0
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); } } } }
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.8.1+commit.df193b15
Unlicense
ipfs://d83e49de1cb60e18b1c0fe135960a118ca85dcf6ebe951cae0c96557753d869a
{ "func_code_index": [ 2160, 2562 ] }
58,807
PROGE
PROGE.sol
0x149fdd2436bb835460277422c7bf17f3b57cffc0
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); } } } }
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.8.1+commit.df193b15
Unlicense
ipfs://d83e49de1cb60e18b1c0fe135960a118ca85dcf6ebe951cae0c96557753d869a
{ "func_code_index": [ 3318, 3496 ] }
58,808
PROGE
PROGE.sol
0x149fdd2436bb835460277422c7bf17f3b57cffc0
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); } } } }
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.8.1+commit.df193b15
Unlicense
ipfs://d83e49de1cb60e18b1c0fe135960a118ca85dcf6ebe951cae0c96557753d869a
{ "func_code_index": [ 3721, 3922 ] }
58,809
PROGE
PROGE.sol
0x149fdd2436bb835460277422c7bf17f3b57cffc0
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); } } } }
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.8.1+commit.df193b15
Unlicense
ipfs://d83e49de1cb60e18b1c0fe135960a118ca85dcf6ebe951cae0c96557753d869a
{ "func_code_index": [ 4292, 4523 ] }
58,810
PROGE
PROGE.sol
0x149fdd2436bb835460277422c7bf17f3b57cffc0
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); } } } }
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.8.1+commit.df193b15
Unlicense
ipfs://d83e49de1cb60e18b1c0fe135960a118ca85dcf6ebe951cae0c96557753d869a
{ "func_code_index": [ 4774, 5095 ] }
58,811
PROGE
PROGE.sol
0x149fdd2436bb835460277422c7bf17f3b57cffc0
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 () { 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; } }
owner
function owner() public view returns (address) { return _owner; }
/** * @dev Returns the address of the current owner. */
NatSpecMultiLine
v0.8.1+commit.df193b15
Unlicense
ipfs://d83e49de1cb60e18b1c0fe135960a118ca85dcf6ebe951cae0c96557753d869a
{ "func_code_index": [ 488, 572 ] }
58,812
PROGE
PROGE.sol
0x149fdd2436bb835460277422c7bf17f3b57cffc0
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 () { 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; } }
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.8.1+commit.df193b15
Unlicense
ipfs://d83e49de1cb60e18b1c0fe135960a118ca85dcf6ebe951cae0c96557753d869a
{ "func_code_index": [ 1130, 1283 ] }
58,813
PROGE
PROGE.sol
0x149fdd2436bb835460277422c7bf17f3b57cffc0
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 () { 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; } }
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.8.1+commit.df193b15
Unlicense
ipfs://d83e49de1cb60e18b1c0fe135960a118ca85dcf6ebe951cae0c96557753d869a
{ "func_code_index": [ 1433, 1682 ] }
58,814
MyAdvancedToken
MyAdvancedToken.sol
0xb68b4bb27861dcdcad76e39323a4da62269586d4
Solidity
owned
contract owned { address public owner; /** * 初台化构造函数 */ function owned () public { owner = msg.sender; } /** * 判断当前合约调用者是否是合约的所有者 */ modifier onlyOwner { require (msg.sender == owner); _; } /** * 合约的所有者指派一个新的管理员 * @param newOwner address 新的管理员帐户地址 */ function transferOwnership(address newOwner) onlyOwner public { if (newOwner != address(0)) { owner = newOwner; } } }
/** * owned是合约的管理者 */
NatSpecMultiLine
owned
function owned () public { owner = msg.sender; }
/** * 初台化构造函数 */
NatSpecMultiLine
v0.4.16+commit.d7661dd9
MIT
bzzr://90d34bb66329f86d4171331463de8c9f346c57ccd941490586ed719dd3bf2eb1
{ "func_code_index": [ 82, 149 ] }
58,815
MyAdvancedToken
MyAdvancedToken.sol
0xb68b4bb27861dcdcad76e39323a4da62269586d4
Solidity
owned
contract owned { address public owner; /** * 初台化构造函数 */ function owned () public { owner = msg.sender; } /** * 判断当前合约调用者是否是合约的所有者 */ modifier onlyOwner { require (msg.sender == owner); _; } /** * 合约的所有者指派一个新的管理员 * @param newOwner address 新的管理员帐户地址 */ function transferOwnership(address newOwner) onlyOwner public { if (newOwner != address(0)) { owner = newOwner; } } }
/** * owned是合约的管理者 */
NatSpecMultiLine
transferOwnership
function transferOwnership(address newOwner) onlyOwner public { if (newOwner != address(0)) { owner = newOwner; } }
/** * 合约的所有者指派一个新的管理员 * @param newOwner address 新的管理员帐户地址 */
NatSpecMultiLine
v0.4.16+commit.d7661dd9
MIT
bzzr://90d34bb66329f86d4171331463de8c9f346c57ccd941490586ed719dd3bf2eb1
{ "func_code_index": [ 371, 521 ] }
58,816
MyAdvancedToken
MyAdvancedToken.sol
0xb68b4bb27861dcdcad76e39323a4da62269586d4
Solidity
TokenERC20
contract TokenERC20 { string public name; //发行的代币名称 string public symbol; //发行的代币符号 uint8 public decimals = 18; //代币单位,展示的小数点后面多少个0。 uint256 public totalSupply; //发行的代币总量 /*记录所有余额的映射*/ mapping (address => uint256) public balanceOf; mapping (address => mapping (address => uint256)) public allowance; /* 在区块链上创建一个事件,用以通知客户端*/ //转帐通知事件 event Transfer(address indexed from, address indexed to, uint256 value); event Burn(address indexed from, uint256 value); //减去用户余额事件 /* 初始化合约,并且把初始的所有代币都给这合约的创建者 * @param initialSupply 代币的总数 * @param tokenName 代币名称 * @param tokenSymbol 代币符号 */ function TokenERC20(uint256 initialSupply, string tokenName, string tokenSymbol) public { //初始化总量 totalSupply = initialSupply * 10 ** uint256(decimals); //给指定帐户初始化代币总量,初始化用于奖励合约创建者 balanceOf[msg.sender] = totalSupply; name = tokenName; symbol = tokenSymbol; } /** * 私有方法从一个帐户发送给另一个帐户代币 * @param _from address 发送代币的地址 * @param _to address 接受代币的地址 * @param _value uint256 接受代币的数量 */ function _transfer(address _from, address _to, uint256 _value) internal { //避免转帐的地址是0x0 require(_to != 0x0); //检查发送者是否拥有足够余额 require(balanceOf[_from] >= _value); //检查是否溢出 require(balanceOf[_to] + _value > balanceOf[_to]); //保存数据用于后面的判断 uint previousBalances = balanceOf[_from] + balanceOf[_to]; //从发送者减掉发送额 balanceOf[_from] -= _value; //给接收者加上相同的量 balanceOf[_to] += _value; //通知任何监听该交易的客户端 Transfer(_from, _to, _value); //判断买、卖双方的数据是否和转换前一致 assert(balanceOf[_from] + balanceOf[_to] == previousBalances); } /** * 从主帐户合约调用者发送给别人代币 * @param _to address 接受代币的地址 * @param _value uint256 接受代币的数量 */ function transfer(address _to, uint256 _value) public { _transfer(msg.sender, _to, _value); } /** * 从某个指定的帐户中,向另一个帐户发送代币 * 调用过程,会检查设置的允许最大交易额 * @param _from address 发送者地址 * @param _to address 接受者地址 * @param _value uint256 要转移的代币数量 * @return success 是否交易成功 */ function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) { //检查发送者是否拥有足够余额 require(_value <= allowance[_from][msg.sender]); allowance[_from][msg.sender] -= _value; _transfer(_from, _to, _value); return true; } /** * 设置帐户允许支付的最大金额 * 一般在智能合约的时候,避免支付过多,造成风险 * @param _spender 帐户地址 * @param _value 金额 */ function approve(address _spender, uint256 _value) public returns (bool success) { allowance[msg.sender][_spender] = _value; return true; } /** * 设置帐户允许支付的最大金额 * 一般在智能合约的时候,避免支付过多,造成风险,加入时间参数,可以在 tokenRecipient 中做其他操作 * @param _spender 帐户地址 * @param _value 金额 * @param _extraData 操作的时间 */ function approveAndCall(address _spender, uint256 _value, bytes _extraData) public returns (bool success) { tokenRecipient spender = tokenRecipient(_spender); if (approve(_spender, _value)) { spender.receiveApproval(msg.sender, _value, this, _extraData); return true; } } /** * 减少代币调用者的余额 * 操作以后是不可逆的 * @param _value 要删除的数量 */ function burn(uint256 _value) public returns (bool success) { //检查帐户余额是否大于要减去的值 require(balanceOf[msg.sender] >= _value); //给指定帐户减去余额 balanceOf[msg.sender] -= _value; //代币问题做相应扣除 totalSupply -= _value; Burn(msg.sender, _value); return true; } /** * 删除帐户的余额(含其他帐户) * 删除以后是不可逆的 * @param _from 要操作的帐户地址 * @param _value 要减去的数量 */ function burnFrom(address _from, uint256 _value) public returns (bool success) { //检查帐户余额是否大于要减去的值 require(balanceOf[_from] >= _value); //检查 其他帐户 的余额是否够使用 require(_value <= allowance[_from][msg.sender]); //减掉代币 balanceOf[_from] -= _value; allowance[_from][msg.sender] -= _value; //更新总量 totalSupply -= _value; Burn(_from, _value); return true; } }
/** * 基础代币合约 */
NatSpecMultiLine
TokenERC20
function TokenERC20(uint256 initialSupply, string tokenName, string tokenSymbol) public { //初始化总量 totalSupply = initialSupply * 10 ** uint256(decimals); //给指定帐户初始化代币总量,初始化用于奖励合约创建者 balanceOf[msg.sender] = totalSupply; name = tokenName; symbol = tokenSymbol; }
/* 初始化合约,并且把初始的所有代币都给这合约的创建者 * @param initialSupply 代币的总数 * @param tokenName 代币名称 * @param tokenSymbol 代币符号 */
Comment
v0.4.16+commit.d7661dd9
MIT
bzzr://90d34bb66329f86d4171331463de8c9f346c57ccd941490586ed719dd3bf2eb1
{ "func_code_index": [ 676, 1002 ] }
58,817
MyAdvancedToken
MyAdvancedToken.sol
0xb68b4bb27861dcdcad76e39323a4da62269586d4
Solidity
TokenERC20
contract TokenERC20 { string public name; //发行的代币名称 string public symbol; //发行的代币符号 uint8 public decimals = 18; //代币单位,展示的小数点后面多少个0。 uint256 public totalSupply; //发行的代币总量 /*记录所有余额的映射*/ mapping (address => uint256) public balanceOf; mapping (address => mapping (address => uint256)) public allowance; /* 在区块链上创建一个事件,用以通知客户端*/ //转帐通知事件 event Transfer(address indexed from, address indexed to, uint256 value); event Burn(address indexed from, uint256 value); //减去用户余额事件 /* 初始化合约,并且把初始的所有代币都给这合约的创建者 * @param initialSupply 代币的总数 * @param tokenName 代币名称 * @param tokenSymbol 代币符号 */ function TokenERC20(uint256 initialSupply, string tokenName, string tokenSymbol) public { //初始化总量 totalSupply = initialSupply * 10 ** uint256(decimals); //给指定帐户初始化代币总量,初始化用于奖励合约创建者 balanceOf[msg.sender] = totalSupply; name = tokenName; symbol = tokenSymbol; } /** * 私有方法从一个帐户发送给另一个帐户代币 * @param _from address 发送代币的地址 * @param _to address 接受代币的地址 * @param _value uint256 接受代币的数量 */ function _transfer(address _from, address _to, uint256 _value) internal { //避免转帐的地址是0x0 require(_to != 0x0); //检查发送者是否拥有足够余额 require(balanceOf[_from] >= _value); //检查是否溢出 require(balanceOf[_to] + _value > balanceOf[_to]); //保存数据用于后面的判断 uint previousBalances = balanceOf[_from] + balanceOf[_to]; //从发送者减掉发送额 balanceOf[_from] -= _value; //给接收者加上相同的量 balanceOf[_to] += _value; //通知任何监听该交易的客户端 Transfer(_from, _to, _value); //判断买、卖双方的数据是否和转换前一致 assert(balanceOf[_from] + balanceOf[_to] == previousBalances); } /** * 从主帐户合约调用者发送给别人代币 * @param _to address 接受代币的地址 * @param _value uint256 接受代币的数量 */ function transfer(address _to, uint256 _value) public { _transfer(msg.sender, _to, _value); } /** * 从某个指定的帐户中,向另一个帐户发送代币 * 调用过程,会检查设置的允许最大交易额 * @param _from address 发送者地址 * @param _to address 接受者地址 * @param _value uint256 要转移的代币数量 * @return success 是否交易成功 */ function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) { //检查发送者是否拥有足够余额 require(_value <= allowance[_from][msg.sender]); allowance[_from][msg.sender] -= _value; _transfer(_from, _to, _value); return true; } /** * 设置帐户允许支付的最大金额 * 一般在智能合约的时候,避免支付过多,造成风险 * @param _spender 帐户地址 * @param _value 金额 */ function approve(address _spender, uint256 _value) public returns (bool success) { allowance[msg.sender][_spender] = _value; return true; } /** * 设置帐户允许支付的最大金额 * 一般在智能合约的时候,避免支付过多,造成风险,加入时间参数,可以在 tokenRecipient 中做其他操作 * @param _spender 帐户地址 * @param _value 金额 * @param _extraData 操作的时间 */ function approveAndCall(address _spender, uint256 _value, bytes _extraData) public returns (bool success) { tokenRecipient spender = tokenRecipient(_spender); if (approve(_spender, _value)) { spender.receiveApproval(msg.sender, _value, this, _extraData); return true; } } /** * 减少代币调用者的余额 * 操作以后是不可逆的 * @param _value 要删除的数量 */ function burn(uint256 _value) public returns (bool success) { //检查帐户余额是否大于要减去的值 require(balanceOf[msg.sender] >= _value); //给指定帐户减去余额 balanceOf[msg.sender] -= _value; //代币问题做相应扣除 totalSupply -= _value; Burn(msg.sender, _value); return true; } /** * 删除帐户的余额(含其他帐户) * 删除以后是不可逆的 * @param _from 要操作的帐户地址 * @param _value 要减去的数量 */ function burnFrom(address _from, uint256 _value) public returns (bool success) { //检查帐户余额是否大于要减去的值 require(balanceOf[_from] >= _value); //检查 其他帐户 的余额是否够使用 require(_value <= allowance[_from][msg.sender]); //减掉代币 balanceOf[_from] -= _value; allowance[_from][msg.sender] -= _value; //更新总量 totalSupply -= _value; Burn(_from, _value); return true; } }
/** * 基础代币合约 */
NatSpecMultiLine
_transfer
function _transfer(address _from, address _to, uint256 _value) internal { //避免转帐的地址是0x0 require(_to != 0x0); //检查发送者是否拥有足够余额 require(balanceOf[_from] >= _value); //检查是否溢出 require(balanceOf[_to] + _value > balanceOf[_to]); //保存数据用于后面的判断 uint previousBalances = balanceOf[_from] + balanceOf[_to]; //从发送者减掉发送额 balanceOf[_from] -= _value; //给接收者加上相同的量 balanceOf[_to] += _value; //通知任何监听该交易的客户端 Transfer(_from, _to, _value); //判断买、卖双方的数据是否和转换前一致 assert(balanceOf[_from] + balanceOf[_to] == previousBalances); }
/** * 私有方法从一个帐户发送给另一个帐户代币 * @param _from address 发送代币的地址 * @param _to address 接受代币的地址 * @param _value uint256 接受代币的数量 */
NatSpecMultiLine
v0.4.16+commit.d7661dd9
MIT
bzzr://90d34bb66329f86d4171331463de8c9f346c57ccd941490586ed719dd3bf2eb1
{ "func_code_index": [ 1168, 1822 ] }
58,818
MyAdvancedToken
MyAdvancedToken.sol
0xb68b4bb27861dcdcad76e39323a4da62269586d4
Solidity
TokenERC20
contract TokenERC20 { string public name; //发行的代币名称 string public symbol; //发行的代币符号 uint8 public decimals = 18; //代币单位,展示的小数点后面多少个0。 uint256 public totalSupply; //发行的代币总量 /*记录所有余额的映射*/ mapping (address => uint256) public balanceOf; mapping (address => mapping (address => uint256)) public allowance; /* 在区块链上创建一个事件,用以通知客户端*/ //转帐通知事件 event Transfer(address indexed from, address indexed to, uint256 value); event Burn(address indexed from, uint256 value); //减去用户余额事件 /* 初始化合约,并且把初始的所有代币都给这合约的创建者 * @param initialSupply 代币的总数 * @param tokenName 代币名称 * @param tokenSymbol 代币符号 */ function TokenERC20(uint256 initialSupply, string tokenName, string tokenSymbol) public { //初始化总量 totalSupply = initialSupply * 10 ** uint256(decimals); //给指定帐户初始化代币总量,初始化用于奖励合约创建者 balanceOf[msg.sender] = totalSupply; name = tokenName; symbol = tokenSymbol; } /** * 私有方法从一个帐户发送给另一个帐户代币 * @param _from address 发送代币的地址 * @param _to address 接受代币的地址 * @param _value uint256 接受代币的数量 */ function _transfer(address _from, address _to, uint256 _value) internal { //避免转帐的地址是0x0 require(_to != 0x0); //检查发送者是否拥有足够余额 require(balanceOf[_from] >= _value); //检查是否溢出 require(balanceOf[_to] + _value > balanceOf[_to]); //保存数据用于后面的判断 uint previousBalances = balanceOf[_from] + balanceOf[_to]; //从发送者减掉发送额 balanceOf[_from] -= _value; //给接收者加上相同的量 balanceOf[_to] += _value; //通知任何监听该交易的客户端 Transfer(_from, _to, _value); //判断买、卖双方的数据是否和转换前一致 assert(balanceOf[_from] + balanceOf[_to] == previousBalances); } /** * 从主帐户合约调用者发送给别人代币 * @param _to address 接受代币的地址 * @param _value uint256 接受代币的数量 */ function transfer(address _to, uint256 _value) public { _transfer(msg.sender, _to, _value); } /** * 从某个指定的帐户中,向另一个帐户发送代币 * 调用过程,会检查设置的允许最大交易额 * @param _from address 发送者地址 * @param _to address 接受者地址 * @param _value uint256 要转移的代币数量 * @return success 是否交易成功 */ function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) { //检查发送者是否拥有足够余额 require(_value <= allowance[_from][msg.sender]); allowance[_from][msg.sender] -= _value; _transfer(_from, _to, _value); return true; } /** * 设置帐户允许支付的最大金额 * 一般在智能合约的时候,避免支付过多,造成风险 * @param _spender 帐户地址 * @param _value 金额 */ function approve(address _spender, uint256 _value) public returns (bool success) { allowance[msg.sender][_spender] = _value; return true; } /** * 设置帐户允许支付的最大金额 * 一般在智能合约的时候,避免支付过多,造成风险,加入时间参数,可以在 tokenRecipient 中做其他操作 * @param _spender 帐户地址 * @param _value 金额 * @param _extraData 操作的时间 */ function approveAndCall(address _spender, uint256 _value, bytes _extraData) public returns (bool success) { tokenRecipient spender = tokenRecipient(_spender); if (approve(_spender, _value)) { spender.receiveApproval(msg.sender, _value, this, _extraData); return true; } } /** * 减少代币调用者的余额 * 操作以后是不可逆的 * @param _value 要删除的数量 */ function burn(uint256 _value) public returns (bool success) { //检查帐户余额是否大于要减去的值 require(balanceOf[msg.sender] >= _value); //给指定帐户减去余额 balanceOf[msg.sender] -= _value; //代币问题做相应扣除 totalSupply -= _value; Burn(msg.sender, _value); return true; } /** * 删除帐户的余额(含其他帐户) * 删除以后是不可逆的 * @param _from 要操作的帐户地址 * @param _value 要减去的数量 */ function burnFrom(address _from, uint256 _value) public returns (bool success) { //检查帐户余额是否大于要减去的值 require(balanceOf[_from] >= _value); //检查 其他帐户 的余额是否够使用 require(_value <= allowance[_from][msg.sender]); //减掉代币 balanceOf[_from] -= _value; allowance[_from][msg.sender] -= _value; //更新总量 totalSupply -= _value; Burn(_from, _value); return true; } }
/** * 基础代币合约 */
NatSpecMultiLine
transfer
function transfer(address _to, uint256 _value) public { _transfer(msg.sender, _to, _value); }
/** * 从主帐户合约调用者发送给别人代币 * @param _to address 接受代币的地址 * @param _value uint256 接受代币的数量 */
NatSpecMultiLine
v0.4.16+commit.d7661dd9
MIT
bzzr://90d34bb66329f86d4171331463de8c9f346c57ccd941490586ed719dd3bf2eb1
{ "func_code_index": [ 1944, 2056 ] }
58,819
MyAdvancedToken
MyAdvancedToken.sol
0xb68b4bb27861dcdcad76e39323a4da62269586d4
Solidity
TokenERC20
contract TokenERC20 { string public name; //发行的代币名称 string public symbol; //发行的代币符号 uint8 public decimals = 18; //代币单位,展示的小数点后面多少个0。 uint256 public totalSupply; //发行的代币总量 /*记录所有余额的映射*/ mapping (address => uint256) public balanceOf; mapping (address => mapping (address => uint256)) public allowance; /* 在区块链上创建一个事件,用以通知客户端*/ //转帐通知事件 event Transfer(address indexed from, address indexed to, uint256 value); event Burn(address indexed from, uint256 value); //减去用户余额事件 /* 初始化合约,并且把初始的所有代币都给这合约的创建者 * @param initialSupply 代币的总数 * @param tokenName 代币名称 * @param tokenSymbol 代币符号 */ function TokenERC20(uint256 initialSupply, string tokenName, string tokenSymbol) public { //初始化总量 totalSupply = initialSupply * 10 ** uint256(decimals); //给指定帐户初始化代币总量,初始化用于奖励合约创建者 balanceOf[msg.sender] = totalSupply; name = tokenName; symbol = tokenSymbol; } /** * 私有方法从一个帐户发送给另一个帐户代币 * @param _from address 发送代币的地址 * @param _to address 接受代币的地址 * @param _value uint256 接受代币的数量 */ function _transfer(address _from, address _to, uint256 _value) internal { //避免转帐的地址是0x0 require(_to != 0x0); //检查发送者是否拥有足够余额 require(balanceOf[_from] >= _value); //检查是否溢出 require(balanceOf[_to] + _value > balanceOf[_to]); //保存数据用于后面的判断 uint previousBalances = balanceOf[_from] + balanceOf[_to]; //从发送者减掉发送额 balanceOf[_from] -= _value; //给接收者加上相同的量 balanceOf[_to] += _value; //通知任何监听该交易的客户端 Transfer(_from, _to, _value); //判断买、卖双方的数据是否和转换前一致 assert(balanceOf[_from] + balanceOf[_to] == previousBalances); } /** * 从主帐户合约调用者发送给别人代币 * @param _to address 接受代币的地址 * @param _value uint256 接受代币的数量 */ function transfer(address _to, uint256 _value) public { _transfer(msg.sender, _to, _value); } /** * 从某个指定的帐户中,向另一个帐户发送代币 * 调用过程,会检查设置的允许最大交易额 * @param _from address 发送者地址 * @param _to address 接受者地址 * @param _value uint256 要转移的代币数量 * @return success 是否交易成功 */ function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) { //检查发送者是否拥有足够余额 require(_value <= allowance[_from][msg.sender]); allowance[_from][msg.sender] -= _value; _transfer(_from, _to, _value); return true; } /** * 设置帐户允许支付的最大金额 * 一般在智能合约的时候,避免支付过多,造成风险 * @param _spender 帐户地址 * @param _value 金额 */ function approve(address _spender, uint256 _value) public returns (bool success) { allowance[msg.sender][_spender] = _value; return true; } /** * 设置帐户允许支付的最大金额 * 一般在智能合约的时候,避免支付过多,造成风险,加入时间参数,可以在 tokenRecipient 中做其他操作 * @param _spender 帐户地址 * @param _value 金额 * @param _extraData 操作的时间 */ function approveAndCall(address _spender, uint256 _value, bytes _extraData) public returns (bool success) { tokenRecipient spender = tokenRecipient(_spender); if (approve(_spender, _value)) { spender.receiveApproval(msg.sender, _value, this, _extraData); return true; } } /** * 减少代币调用者的余额 * 操作以后是不可逆的 * @param _value 要删除的数量 */ function burn(uint256 _value) public returns (bool success) { //检查帐户余额是否大于要减去的值 require(balanceOf[msg.sender] >= _value); //给指定帐户减去余额 balanceOf[msg.sender] -= _value; //代币问题做相应扣除 totalSupply -= _value; Burn(msg.sender, _value); return true; } /** * 删除帐户的余额(含其他帐户) * 删除以后是不可逆的 * @param _from 要操作的帐户地址 * @param _value 要减去的数量 */ function burnFrom(address _from, uint256 _value) public returns (bool success) { //检查帐户余额是否大于要减去的值 require(balanceOf[_from] >= _value); //检查 其他帐户 的余额是否够使用 require(_value <= allowance[_from][msg.sender]); //减掉代币 balanceOf[_from] -= _value; allowance[_from][msg.sender] -= _value; //更新总量 totalSupply -= _value; Burn(_from, _value); return true; } }
/** * 基础代币合约 */
NatSpecMultiLine
transferFrom
function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) { //检查发送者是否拥有足够余额 require(_value <= allowance[_from][msg.sender]); allowance[_from][msg.sender] -= _value; _transfer(_from, _to, _value); return true; }
/** * 从某个指定的帐户中,向另一个帐户发送代币 * 调用过程,会检查设置的允许最大交易额 * @param _from address 发送者地址 * @param _to address 接受者地址 * @param _value uint256 要转移的代币数量 * @return success 是否交易成功 */
NatSpecMultiLine
v0.4.16+commit.d7661dd9
MIT
bzzr://90d34bb66329f86d4171331463de8c9f346c57ccd941490586ed719dd3bf2eb1
{ "func_code_index": [ 2282, 2585 ] }
58,820
MyAdvancedToken
MyAdvancedToken.sol
0xb68b4bb27861dcdcad76e39323a4da62269586d4
Solidity
TokenERC20
contract TokenERC20 { string public name; //发行的代币名称 string public symbol; //发行的代币符号 uint8 public decimals = 18; //代币单位,展示的小数点后面多少个0。 uint256 public totalSupply; //发行的代币总量 /*记录所有余额的映射*/ mapping (address => uint256) public balanceOf; mapping (address => mapping (address => uint256)) public allowance; /* 在区块链上创建一个事件,用以通知客户端*/ //转帐通知事件 event Transfer(address indexed from, address indexed to, uint256 value); event Burn(address indexed from, uint256 value); //减去用户余额事件 /* 初始化合约,并且把初始的所有代币都给这合约的创建者 * @param initialSupply 代币的总数 * @param tokenName 代币名称 * @param tokenSymbol 代币符号 */ function TokenERC20(uint256 initialSupply, string tokenName, string tokenSymbol) public { //初始化总量 totalSupply = initialSupply * 10 ** uint256(decimals); //给指定帐户初始化代币总量,初始化用于奖励合约创建者 balanceOf[msg.sender] = totalSupply; name = tokenName; symbol = tokenSymbol; } /** * 私有方法从一个帐户发送给另一个帐户代币 * @param _from address 发送代币的地址 * @param _to address 接受代币的地址 * @param _value uint256 接受代币的数量 */ function _transfer(address _from, address _to, uint256 _value) internal { //避免转帐的地址是0x0 require(_to != 0x0); //检查发送者是否拥有足够余额 require(balanceOf[_from] >= _value); //检查是否溢出 require(balanceOf[_to] + _value > balanceOf[_to]); //保存数据用于后面的判断 uint previousBalances = balanceOf[_from] + balanceOf[_to]; //从发送者减掉发送额 balanceOf[_from] -= _value; //给接收者加上相同的量 balanceOf[_to] += _value; //通知任何监听该交易的客户端 Transfer(_from, _to, _value); //判断买、卖双方的数据是否和转换前一致 assert(balanceOf[_from] + balanceOf[_to] == previousBalances); } /** * 从主帐户合约调用者发送给别人代币 * @param _to address 接受代币的地址 * @param _value uint256 接受代币的数量 */ function transfer(address _to, uint256 _value) public { _transfer(msg.sender, _to, _value); } /** * 从某个指定的帐户中,向另一个帐户发送代币 * 调用过程,会检查设置的允许最大交易额 * @param _from address 发送者地址 * @param _to address 接受者地址 * @param _value uint256 要转移的代币数量 * @return success 是否交易成功 */ function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) { //检查发送者是否拥有足够余额 require(_value <= allowance[_from][msg.sender]); allowance[_from][msg.sender] -= _value; _transfer(_from, _to, _value); return true; } /** * 设置帐户允许支付的最大金额 * 一般在智能合约的时候,避免支付过多,造成风险 * @param _spender 帐户地址 * @param _value 金额 */ function approve(address _spender, uint256 _value) public returns (bool success) { allowance[msg.sender][_spender] = _value; return true; } /** * 设置帐户允许支付的最大金额 * 一般在智能合约的时候,避免支付过多,造成风险,加入时间参数,可以在 tokenRecipient 中做其他操作 * @param _spender 帐户地址 * @param _value 金额 * @param _extraData 操作的时间 */ function approveAndCall(address _spender, uint256 _value, bytes _extraData) public returns (bool success) { tokenRecipient spender = tokenRecipient(_spender); if (approve(_spender, _value)) { spender.receiveApproval(msg.sender, _value, this, _extraData); return true; } } /** * 减少代币调用者的余额 * 操作以后是不可逆的 * @param _value 要删除的数量 */ function burn(uint256 _value) public returns (bool success) { //检查帐户余额是否大于要减去的值 require(balanceOf[msg.sender] >= _value); //给指定帐户减去余额 balanceOf[msg.sender] -= _value; //代币问题做相应扣除 totalSupply -= _value; Burn(msg.sender, _value); return true; } /** * 删除帐户的余额(含其他帐户) * 删除以后是不可逆的 * @param _from 要操作的帐户地址 * @param _value 要减去的数量 */ function burnFrom(address _from, uint256 _value) public returns (bool success) { //检查帐户余额是否大于要减去的值 require(balanceOf[_from] >= _value); //检查 其他帐户 的余额是否够使用 require(_value <= allowance[_from][msg.sender]); //减掉代币 balanceOf[_from] -= _value; allowance[_from][msg.sender] -= _value; //更新总量 totalSupply -= _value; Burn(_from, _value); return true; } }
/** * 基础代币合约 */
NatSpecMultiLine
approve
function approve(address _spender, uint256 _value) public returns (bool success) { allowance[msg.sender][_spender] = _value; return true; }
/** * 设置帐户允许支付的最大金额 * 一般在智能合约的时候,避免支付过多,造成风险 * @param _spender 帐户地址 * @param _value 金额 */
NatSpecMultiLine
v0.4.16+commit.d7661dd9
MIT
bzzr://90d34bb66329f86d4171331463de8c9f346c57ccd941490586ed719dd3bf2eb1
{ "func_code_index": [ 2714, 2881 ] }
58,821
MyAdvancedToken
MyAdvancedToken.sol
0xb68b4bb27861dcdcad76e39323a4da62269586d4
Solidity
TokenERC20
contract TokenERC20 { string public name; //发行的代币名称 string public symbol; //发行的代币符号 uint8 public decimals = 18; //代币单位,展示的小数点后面多少个0。 uint256 public totalSupply; //发行的代币总量 /*记录所有余额的映射*/ mapping (address => uint256) public balanceOf; mapping (address => mapping (address => uint256)) public allowance; /* 在区块链上创建一个事件,用以通知客户端*/ //转帐通知事件 event Transfer(address indexed from, address indexed to, uint256 value); event Burn(address indexed from, uint256 value); //减去用户余额事件 /* 初始化合约,并且把初始的所有代币都给这合约的创建者 * @param initialSupply 代币的总数 * @param tokenName 代币名称 * @param tokenSymbol 代币符号 */ function TokenERC20(uint256 initialSupply, string tokenName, string tokenSymbol) public { //初始化总量 totalSupply = initialSupply * 10 ** uint256(decimals); //给指定帐户初始化代币总量,初始化用于奖励合约创建者 balanceOf[msg.sender] = totalSupply; name = tokenName; symbol = tokenSymbol; } /** * 私有方法从一个帐户发送给另一个帐户代币 * @param _from address 发送代币的地址 * @param _to address 接受代币的地址 * @param _value uint256 接受代币的数量 */ function _transfer(address _from, address _to, uint256 _value) internal { //避免转帐的地址是0x0 require(_to != 0x0); //检查发送者是否拥有足够余额 require(balanceOf[_from] >= _value); //检查是否溢出 require(balanceOf[_to] + _value > balanceOf[_to]); //保存数据用于后面的判断 uint previousBalances = balanceOf[_from] + balanceOf[_to]; //从发送者减掉发送额 balanceOf[_from] -= _value; //给接收者加上相同的量 balanceOf[_to] += _value; //通知任何监听该交易的客户端 Transfer(_from, _to, _value); //判断买、卖双方的数据是否和转换前一致 assert(balanceOf[_from] + balanceOf[_to] == previousBalances); } /** * 从主帐户合约调用者发送给别人代币 * @param _to address 接受代币的地址 * @param _value uint256 接受代币的数量 */ function transfer(address _to, uint256 _value) public { _transfer(msg.sender, _to, _value); } /** * 从某个指定的帐户中,向另一个帐户发送代币 * 调用过程,会检查设置的允许最大交易额 * @param _from address 发送者地址 * @param _to address 接受者地址 * @param _value uint256 要转移的代币数量 * @return success 是否交易成功 */ function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) { //检查发送者是否拥有足够余额 require(_value <= allowance[_from][msg.sender]); allowance[_from][msg.sender] -= _value; _transfer(_from, _to, _value); return true; } /** * 设置帐户允许支付的最大金额 * 一般在智能合约的时候,避免支付过多,造成风险 * @param _spender 帐户地址 * @param _value 金额 */ function approve(address _spender, uint256 _value) public returns (bool success) { allowance[msg.sender][_spender] = _value; return true; } /** * 设置帐户允许支付的最大金额 * 一般在智能合约的时候,避免支付过多,造成风险,加入时间参数,可以在 tokenRecipient 中做其他操作 * @param _spender 帐户地址 * @param _value 金额 * @param _extraData 操作的时间 */ function approveAndCall(address _spender, uint256 _value, bytes _extraData) public returns (bool success) { tokenRecipient spender = tokenRecipient(_spender); if (approve(_spender, _value)) { spender.receiveApproval(msg.sender, _value, this, _extraData); return true; } } /** * 减少代币调用者的余额 * 操作以后是不可逆的 * @param _value 要删除的数量 */ function burn(uint256 _value) public returns (bool success) { //检查帐户余额是否大于要减去的值 require(balanceOf[msg.sender] >= _value); //给指定帐户减去余额 balanceOf[msg.sender] -= _value; //代币问题做相应扣除 totalSupply -= _value; Burn(msg.sender, _value); return true; } /** * 删除帐户的余额(含其他帐户) * 删除以后是不可逆的 * @param _from 要操作的帐户地址 * @param _value 要减去的数量 */ function burnFrom(address _from, uint256 _value) public returns (bool success) { //检查帐户余额是否大于要减去的值 require(balanceOf[_from] >= _value); //检查 其他帐户 的余额是否够使用 require(_value <= allowance[_from][msg.sender]); //减掉代币 balanceOf[_from] -= _value; allowance[_from][msg.sender] -= _value; //更新总量 totalSupply -= _value; Burn(_from, _value); return true; } }
/** * 基础代币合约 */
NatSpecMultiLine
approveAndCall
function approveAndCall(address _spender, uint256 _value, bytes _extraData) public returns (bool success) { tokenRecipient spender = tokenRecipient(_spender); if (approve(_spender, _value)) { spender.receiveApproval(msg.sender, _value, this, _extraData); return true; } }
/** * 设置帐户允许支付的最大金额 * 一般在智能合约的时候,避免支付过多,造成风险,加入时间参数,可以在 tokenRecipient 中做其他操作 * @param _spender 帐户地址 * @param _value 金额 * @param _extraData 操作的时间 */
NatSpecMultiLine
v0.4.16+commit.d7661dd9
MIT
bzzr://90d34bb66329f86d4171331463de8c9f346c57ccd941490586ed719dd3bf2eb1
{ "func_code_index": [ 3075, 3409 ] }
58,822
MyAdvancedToken
MyAdvancedToken.sol
0xb68b4bb27861dcdcad76e39323a4da62269586d4
Solidity
TokenERC20
contract TokenERC20 { string public name; //发行的代币名称 string public symbol; //发行的代币符号 uint8 public decimals = 18; //代币单位,展示的小数点后面多少个0。 uint256 public totalSupply; //发行的代币总量 /*记录所有余额的映射*/ mapping (address => uint256) public balanceOf; mapping (address => mapping (address => uint256)) public allowance; /* 在区块链上创建一个事件,用以通知客户端*/ //转帐通知事件 event Transfer(address indexed from, address indexed to, uint256 value); event Burn(address indexed from, uint256 value); //减去用户余额事件 /* 初始化合约,并且把初始的所有代币都给这合约的创建者 * @param initialSupply 代币的总数 * @param tokenName 代币名称 * @param tokenSymbol 代币符号 */ function TokenERC20(uint256 initialSupply, string tokenName, string tokenSymbol) public { //初始化总量 totalSupply = initialSupply * 10 ** uint256(decimals); //给指定帐户初始化代币总量,初始化用于奖励合约创建者 balanceOf[msg.sender] = totalSupply; name = tokenName; symbol = tokenSymbol; } /** * 私有方法从一个帐户发送给另一个帐户代币 * @param _from address 发送代币的地址 * @param _to address 接受代币的地址 * @param _value uint256 接受代币的数量 */ function _transfer(address _from, address _to, uint256 _value) internal { //避免转帐的地址是0x0 require(_to != 0x0); //检查发送者是否拥有足够余额 require(balanceOf[_from] >= _value); //检查是否溢出 require(balanceOf[_to] + _value > balanceOf[_to]); //保存数据用于后面的判断 uint previousBalances = balanceOf[_from] + balanceOf[_to]; //从发送者减掉发送额 balanceOf[_from] -= _value; //给接收者加上相同的量 balanceOf[_to] += _value; //通知任何监听该交易的客户端 Transfer(_from, _to, _value); //判断买、卖双方的数据是否和转换前一致 assert(balanceOf[_from] + balanceOf[_to] == previousBalances); } /** * 从主帐户合约调用者发送给别人代币 * @param _to address 接受代币的地址 * @param _value uint256 接受代币的数量 */ function transfer(address _to, uint256 _value) public { _transfer(msg.sender, _to, _value); } /** * 从某个指定的帐户中,向另一个帐户发送代币 * 调用过程,会检查设置的允许最大交易额 * @param _from address 发送者地址 * @param _to address 接受者地址 * @param _value uint256 要转移的代币数量 * @return success 是否交易成功 */ function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) { //检查发送者是否拥有足够余额 require(_value <= allowance[_from][msg.sender]); allowance[_from][msg.sender] -= _value; _transfer(_from, _to, _value); return true; } /** * 设置帐户允许支付的最大金额 * 一般在智能合约的时候,避免支付过多,造成风险 * @param _spender 帐户地址 * @param _value 金额 */ function approve(address _spender, uint256 _value) public returns (bool success) { allowance[msg.sender][_spender] = _value; return true; } /** * 设置帐户允许支付的最大金额 * 一般在智能合约的时候,避免支付过多,造成风险,加入时间参数,可以在 tokenRecipient 中做其他操作 * @param _spender 帐户地址 * @param _value 金额 * @param _extraData 操作的时间 */ function approveAndCall(address _spender, uint256 _value, bytes _extraData) public returns (bool success) { tokenRecipient spender = tokenRecipient(_spender); if (approve(_spender, _value)) { spender.receiveApproval(msg.sender, _value, this, _extraData); return true; } } /** * 减少代币调用者的余额 * 操作以后是不可逆的 * @param _value 要删除的数量 */ function burn(uint256 _value) public returns (bool success) { //检查帐户余额是否大于要减去的值 require(balanceOf[msg.sender] >= _value); //给指定帐户减去余额 balanceOf[msg.sender] -= _value; //代币问题做相应扣除 totalSupply -= _value; Burn(msg.sender, _value); return true; } /** * 删除帐户的余额(含其他帐户) * 删除以后是不可逆的 * @param _from 要操作的帐户地址 * @param _value 要减去的数量 */ function burnFrom(address _from, uint256 _value) public returns (bool success) { //检查帐户余额是否大于要减去的值 require(balanceOf[_from] >= _value); //检查 其他帐户 的余额是否够使用 require(_value <= allowance[_from][msg.sender]); //减掉代币 balanceOf[_from] -= _value; allowance[_from][msg.sender] -= _value; //更新总量 totalSupply -= _value; Burn(_from, _value); return true; } }
/** * 基础代币合约 */
NatSpecMultiLine
burn
function burn(uint256 _value) public returns (bool success) { //检查帐户余额是否大于要减去的值 require(balanceOf[msg.sender] >= _value); //给指定帐户减去余额 balanceOf[msg.sender] -= _value; //代币问题做相应扣除 totalSupply -= _value; Burn(msg.sender, _value); return true; }
/** * 减少代币调用者的余额 * 操作以后是不可逆的 * @param _value 要删除的数量 */
NatSpecMultiLine
v0.4.16+commit.d7661dd9
MIT
bzzr://90d34bb66329f86d4171331463de8c9f346c57ccd941490586ed719dd3bf2eb1
{ "func_code_index": [ 3497, 3821 ] }
58,823
MyAdvancedToken
MyAdvancedToken.sol
0xb68b4bb27861dcdcad76e39323a4da62269586d4
Solidity
TokenERC20
contract TokenERC20 { string public name; //发行的代币名称 string public symbol; //发行的代币符号 uint8 public decimals = 18; //代币单位,展示的小数点后面多少个0。 uint256 public totalSupply; //发行的代币总量 /*记录所有余额的映射*/ mapping (address => uint256) public balanceOf; mapping (address => mapping (address => uint256)) public allowance; /* 在区块链上创建一个事件,用以通知客户端*/ //转帐通知事件 event Transfer(address indexed from, address indexed to, uint256 value); event Burn(address indexed from, uint256 value); //减去用户余额事件 /* 初始化合约,并且把初始的所有代币都给这合约的创建者 * @param initialSupply 代币的总数 * @param tokenName 代币名称 * @param tokenSymbol 代币符号 */ function TokenERC20(uint256 initialSupply, string tokenName, string tokenSymbol) public { //初始化总量 totalSupply = initialSupply * 10 ** uint256(decimals); //给指定帐户初始化代币总量,初始化用于奖励合约创建者 balanceOf[msg.sender] = totalSupply; name = tokenName; symbol = tokenSymbol; } /** * 私有方法从一个帐户发送给另一个帐户代币 * @param _from address 发送代币的地址 * @param _to address 接受代币的地址 * @param _value uint256 接受代币的数量 */ function _transfer(address _from, address _to, uint256 _value) internal { //避免转帐的地址是0x0 require(_to != 0x0); //检查发送者是否拥有足够余额 require(balanceOf[_from] >= _value); //检查是否溢出 require(balanceOf[_to] + _value > balanceOf[_to]); //保存数据用于后面的判断 uint previousBalances = balanceOf[_from] + balanceOf[_to]; //从发送者减掉发送额 balanceOf[_from] -= _value; //给接收者加上相同的量 balanceOf[_to] += _value; //通知任何监听该交易的客户端 Transfer(_from, _to, _value); //判断买、卖双方的数据是否和转换前一致 assert(balanceOf[_from] + balanceOf[_to] == previousBalances); } /** * 从主帐户合约调用者发送给别人代币 * @param _to address 接受代币的地址 * @param _value uint256 接受代币的数量 */ function transfer(address _to, uint256 _value) public { _transfer(msg.sender, _to, _value); } /** * 从某个指定的帐户中,向另一个帐户发送代币 * 调用过程,会检查设置的允许最大交易额 * @param _from address 发送者地址 * @param _to address 接受者地址 * @param _value uint256 要转移的代币数量 * @return success 是否交易成功 */ function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) { //检查发送者是否拥有足够余额 require(_value <= allowance[_from][msg.sender]); allowance[_from][msg.sender] -= _value; _transfer(_from, _to, _value); return true; } /** * 设置帐户允许支付的最大金额 * 一般在智能合约的时候,避免支付过多,造成风险 * @param _spender 帐户地址 * @param _value 金额 */ function approve(address _spender, uint256 _value) public returns (bool success) { allowance[msg.sender][_spender] = _value; return true; } /** * 设置帐户允许支付的最大金额 * 一般在智能合约的时候,避免支付过多,造成风险,加入时间参数,可以在 tokenRecipient 中做其他操作 * @param _spender 帐户地址 * @param _value 金额 * @param _extraData 操作的时间 */ function approveAndCall(address _spender, uint256 _value, bytes _extraData) public returns (bool success) { tokenRecipient spender = tokenRecipient(_spender); if (approve(_spender, _value)) { spender.receiveApproval(msg.sender, _value, this, _extraData); return true; } } /** * 减少代币调用者的余额 * 操作以后是不可逆的 * @param _value 要删除的数量 */ function burn(uint256 _value) public returns (bool success) { //检查帐户余额是否大于要减去的值 require(balanceOf[msg.sender] >= _value); //给指定帐户减去余额 balanceOf[msg.sender] -= _value; //代币问题做相应扣除 totalSupply -= _value; Burn(msg.sender, _value); return true; } /** * 删除帐户的余额(含其他帐户) * 删除以后是不可逆的 * @param _from 要操作的帐户地址 * @param _value 要减去的数量 */ function burnFrom(address _from, uint256 _value) public returns (bool success) { //检查帐户余额是否大于要减去的值 require(balanceOf[_from] >= _value); //检查 其他帐户 的余额是否够使用 require(_value <= allowance[_from][msg.sender]); //减掉代币 balanceOf[_from] -= _value; allowance[_from][msg.sender] -= _value; //更新总量 totalSupply -= _value; Burn(_from, _value); return true; } }
/** * 基础代币合约 */
NatSpecMultiLine
burnFrom
function burnFrom(address _from, uint256 _value) public returns (bool success) { //检查帐户余额是否大于要减去的值 require(balanceOf[_from] >= _value); //检查 其他帐户 的余额是否够使用 require(_value <= allowance[_from][msg.sender]); //减掉代币 balanceOf[_from] -= _value; allowance[_from][msg.sender] -= _value; //更新总量 totalSupply -= _value; Burn(_from, _value); return true; }
/** * 删除帐户的余额(含其他帐户) * 删除以后是不可逆的 * @param _from 要操作的帐户地址 * @param _value 要减去的数量 */
NatSpecMultiLine
v0.4.16+commit.d7661dd9
MIT
bzzr://90d34bb66329f86d4171331463de8c9f346c57ccd941490586ed719dd3bf2eb1
{ "func_code_index": [ 3943, 4396 ] }
58,824
MyAdvancedToken
MyAdvancedToken.sol
0xb68b4bb27861dcdcad76e39323a4da62269586d4
Solidity
MyAdvancedToken
contract MyAdvancedToken is owned, TokenERC20 { //卖出的汇率,一个代币,可以卖出多少个以太币,单位是wei uint256 public sellPrice; //买入的汇率,1个以太币,可以买几个代币 uint256 public buyPrice; /*初始化合约,并且把初始的所有的令牌都给这合约的创建者 * @param initialSupply 所有币的总数 * @param tokenName 代币名称 * @param tokenSymbol 代币符号 */ function MyAdvancedToken( uint256 initialSupply, string tokenName, string tokenSymbol ) TokenERC20(initialSupply, tokenName, tokenSymbol) public {} /** * 私有方法,从指定帐户转出余额 * @param _from address 发送代币的地址 * @param _to address 接受代币的地址 * @param _value uint256 接受代币的数量 */ function _transfer(address _from, address _to, uint _value) internal { //避免转帐的地址是0x0 require (_to != 0x0); //检查发送者是否拥有足够余额 require (balanceOf[_from] > _value); //检查是否溢出 require (balanceOf[_to] + _value > balanceOf[_to]); //从发送者减掉发送额 balanceOf[_from] -= _value; //给接收者加上相同的量 balanceOf[_to] += _value; //通知任何监听该交易的客户端 Transfer(_from, _to, _value); } /** * 合约拥有者,可以为指定帐户创造一些代币 * @param target address 帐户地址 * @param mintedAmount uint256 增加的金额(单位是wei) */ function mintToken(address target, uint256 mintedAmount) onlyOwner public { //给指定地址增加代币,同时总量也相加 balanceOf[target] += mintedAmount; totalSupply += mintedAmount; Transfer(0, this, mintedAmount); Transfer(this, target, mintedAmount); } /** * 设置买卖价格 * * 如果你想让ether(或其他代币)为你的代币进行背书,以便可以市场价自动化买卖代币,我们可以这么做。如果要使用浮动的价格,也可以在这里设置 * * @param newSellPrice 新的卖出价格 * @param newBuyPrice 新的买入价格 */ function setPrices(uint256 newSellPrice, uint256 newBuyPrice) onlyOwner public { sellPrice = newSellPrice; buyPrice = newBuyPrice; } /** * 使用以太币购买代币 */ function buy() payable public { uint amount = msg.value / buyPrice; _transfer(this, msg.sender, amount); } /** * @dev 卖出代币 * @return 要卖出的数量(单位是wei) */ function sell(uint256 amount) public { //检查合约的余额是否充足 require(this.balance >= amount * sellPrice); _transfer(msg.sender, this, amount); msg.sender.transfer(amount * sellPrice); } }
/** * 代币增发、 * 代币自动销售和购买、 * 高级代币功能 */
NatSpecMultiLine
MyAdvancedToken
function MyAdvancedToken( uint256 initialSupply, string tokenName, string tokenSymbol kenERC20(initialSupply, tokenName, tokenSymbol) public {}
/*初始化合约,并且把初始的所有的令牌都给这合约的创建者 * @param initialSupply 所有币的总数 * @param tokenName 代币名称 * @param tokenSymbol 代币符号 */
Comment
v0.4.16+commit.d7661dd9
MIT
bzzr://90d34bb66329f86d4171331463de8c9f346c57ccd941490586ed719dd3bf2eb1
{ "func_code_index": [ 326, 514 ] }
58,825
MyAdvancedToken
MyAdvancedToken.sol
0xb68b4bb27861dcdcad76e39323a4da62269586d4
Solidity
MyAdvancedToken
contract MyAdvancedToken is owned, TokenERC20 { //卖出的汇率,一个代币,可以卖出多少个以太币,单位是wei uint256 public sellPrice; //买入的汇率,1个以太币,可以买几个代币 uint256 public buyPrice; /*初始化合约,并且把初始的所有的令牌都给这合约的创建者 * @param initialSupply 所有币的总数 * @param tokenName 代币名称 * @param tokenSymbol 代币符号 */ function MyAdvancedToken( uint256 initialSupply, string tokenName, string tokenSymbol ) TokenERC20(initialSupply, tokenName, tokenSymbol) public {} /** * 私有方法,从指定帐户转出余额 * @param _from address 发送代币的地址 * @param _to address 接受代币的地址 * @param _value uint256 接受代币的数量 */ function _transfer(address _from, address _to, uint _value) internal { //避免转帐的地址是0x0 require (_to != 0x0); //检查发送者是否拥有足够余额 require (balanceOf[_from] > _value); //检查是否溢出 require (balanceOf[_to] + _value > balanceOf[_to]); //从发送者减掉发送额 balanceOf[_from] -= _value; //给接收者加上相同的量 balanceOf[_to] += _value; //通知任何监听该交易的客户端 Transfer(_from, _to, _value); } /** * 合约拥有者,可以为指定帐户创造一些代币 * @param target address 帐户地址 * @param mintedAmount uint256 增加的金额(单位是wei) */ function mintToken(address target, uint256 mintedAmount) onlyOwner public { //给指定地址增加代币,同时总量也相加 balanceOf[target] += mintedAmount; totalSupply += mintedAmount; Transfer(0, this, mintedAmount); Transfer(this, target, mintedAmount); } /** * 设置买卖价格 * * 如果你想让ether(或其他代币)为你的代币进行背书,以便可以市场价自动化买卖代币,我们可以这么做。如果要使用浮动的价格,也可以在这里设置 * * @param newSellPrice 新的卖出价格 * @param newBuyPrice 新的买入价格 */ function setPrices(uint256 newSellPrice, uint256 newBuyPrice) onlyOwner public { sellPrice = newSellPrice; buyPrice = newBuyPrice; } /** * 使用以太币购买代币 */ function buy() payable public { uint amount = msg.value / buyPrice; _transfer(this, msg.sender, amount); } /** * @dev 卖出代币 * @return 要卖出的数量(单位是wei) */ function sell(uint256 amount) public { //检查合约的余额是否充足 require(this.balance >= amount * sellPrice); _transfer(msg.sender, this, amount); msg.sender.transfer(amount * sellPrice); } }
/** * 代币增发、 * 代币自动销售和购买、 * 高级代币功能 */
NatSpecMultiLine
_transfer
function _transfer(address _from, address _to, uint _value) internal { //避免转帐的地址是0x0 require (_to != 0x0); //检查发送者是否拥有足够余额 require (balanceOf[_from] > _value); //检查是否溢出 require (balanceOf[_to] + _value > balanceOf[_to]); //从发送者减掉发送额 balanceOf[_from] -= _value; //给接收者加上相同的量 balanceOf[_to] += _value; //通知任何监听该交易的客户端 Transfer(_from, _to, _value); }
/** * 私有方法,从指定帐户转出余额 * @param _from address 发送代币的地址 * @param _to address 接受代币的地址 * @param _value uint256 接受代币的数量 */
NatSpecMultiLine
v0.4.16+commit.d7661dd9
MIT
bzzr://90d34bb66329f86d4171331463de8c9f346c57ccd941490586ed719dd3bf2eb1
{ "func_code_index": [ 675, 1161 ] }
58,826
MyAdvancedToken
MyAdvancedToken.sol
0xb68b4bb27861dcdcad76e39323a4da62269586d4
Solidity
MyAdvancedToken
contract MyAdvancedToken is owned, TokenERC20 { //卖出的汇率,一个代币,可以卖出多少个以太币,单位是wei uint256 public sellPrice; //买入的汇率,1个以太币,可以买几个代币 uint256 public buyPrice; /*初始化合约,并且把初始的所有的令牌都给这合约的创建者 * @param initialSupply 所有币的总数 * @param tokenName 代币名称 * @param tokenSymbol 代币符号 */ function MyAdvancedToken( uint256 initialSupply, string tokenName, string tokenSymbol ) TokenERC20(initialSupply, tokenName, tokenSymbol) public {} /** * 私有方法,从指定帐户转出余额 * @param _from address 发送代币的地址 * @param _to address 接受代币的地址 * @param _value uint256 接受代币的数量 */ function _transfer(address _from, address _to, uint _value) internal { //避免转帐的地址是0x0 require (_to != 0x0); //检查发送者是否拥有足够余额 require (balanceOf[_from] > _value); //检查是否溢出 require (balanceOf[_to] + _value > balanceOf[_to]); //从发送者减掉发送额 balanceOf[_from] -= _value; //给接收者加上相同的量 balanceOf[_to] += _value; //通知任何监听该交易的客户端 Transfer(_from, _to, _value); } /** * 合约拥有者,可以为指定帐户创造一些代币 * @param target address 帐户地址 * @param mintedAmount uint256 增加的金额(单位是wei) */ function mintToken(address target, uint256 mintedAmount) onlyOwner public { //给指定地址增加代币,同时总量也相加 balanceOf[target] += mintedAmount; totalSupply += mintedAmount; Transfer(0, this, mintedAmount); Transfer(this, target, mintedAmount); } /** * 设置买卖价格 * * 如果你想让ether(或其他代币)为你的代币进行背书,以便可以市场价自动化买卖代币,我们可以这么做。如果要使用浮动的价格,也可以在这里设置 * * @param newSellPrice 新的卖出价格 * @param newBuyPrice 新的买入价格 */ function setPrices(uint256 newSellPrice, uint256 newBuyPrice) onlyOwner public { sellPrice = newSellPrice; buyPrice = newBuyPrice; } /** * 使用以太币购买代币 */ function buy() payable public { uint amount = msg.value / buyPrice; _transfer(this, msg.sender, amount); } /** * @dev 卖出代币 * @return 要卖出的数量(单位是wei) */ function sell(uint256 amount) public { //检查合约的余额是否充足 require(this.balance >= amount * sellPrice); _transfer(msg.sender, this, amount); msg.sender.transfer(amount * sellPrice); } }
/** * 代币增发、 * 代币自动销售和购买、 * 高级代币功能 */
NatSpecMultiLine
mintToken
function mintToken(address target, uint256 mintedAmount) onlyOwner public { //给指定地址增加代币,同时总量也相加 balanceOf[target] += mintedAmount; totalSupply += mintedAmount; Transfer(0, this, mintedAmount); Transfer(this, target, mintedAmount); }
/** * 合约拥有者,可以为指定帐户创造一些代币 * @param target address 帐户地址 * @param mintedAmount uint256 增加的金额(单位是wei) */
NatSpecMultiLine
v0.4.16+commit.d7661dd9
MIT
bzzr://90d34bb66329f86d4171331463de8c9f346c57ccd941490586ed719dd3bf2eb1
{ "func_code_index": [ 1298, 1594 ] }
58,827
MyAdvancedToken
MyAdvancedToken.sol
0xb68b4bb27861dcdcad76e39323a4da62269586d4
Solidity
MyAdvancedToken
contract MyAdvancedToken is owned, TokenERC20 { //卖出的汇率,一个代币,可以卖出多少个以太币,单位是wei uint256 public sellPrice; //买入的汇率,1个以太币,可以买几个代币 uint256 public buyPrice; /*初始化合约,并且把初始的所有的令牌都给这合约的创建者 * @param initialSupply 所有币的总数 * @param tokenName 代币名称 * @param tokenSymbol 代币符号 */ function MyAdvancedToken( uint256 initialSupply, string tokenName, string tokenSymbol ) TokenERC20(initialSupply, tokenName, tokenSymbol) public {} /** * 私有方法,从指定帐户转出余额 * @param _from address 发送代币的地址 * @param _to address 接受代币的地址 * @param _value uint256 接受代币的数量 */ function _transfer(address _from, address _to, uint _value) internal { //避免转帐的地址是0x0 require (_to != 0x0); //检查发送者是否拥有足够余额 require (balanceOf[_from] > _value); //检查是否溢出 require (balanceOf[_to] + _value > balanceOf[_to]); //从发送者减掉发送额 balanceOf[_from] -= _value; //给接收者加上相同的量 balanceOf[_to] += _value; //通知任何监听该交易的客户端 Transfer(_from, _to, _value); } /** * 合约拥有者,可以为指定帐户创造一些代币 * @param target address 帐户地址 * @param mintedAmount uint256 增加的金额(单位是wei) */ function mintToken(address target, uint256 mintedAmount) onlyOwner public { //给指定地址增加代币,同时总量也相加 balanceOf[target] += mintedAmount; totalSupply += mintedAmount; Transfer(0, this, mintedAmount); Transfer(this, target, mintedAmount); } /** * 设置买卖价格 * * 如果你想让ether(或其他代币)为你的代币进行背书,以便可以市场价自动化买卖代币,我们可以这么做。如果要使用浮动的价格,也可以在这里设置 * * @param newSellPrice 新的卖出价格 * @param newBuyPrice 新的买入价格 */ function setPrices(uint256 newSellPrice, uint256 newBuyPrice) onlyOwner public { sellPrice = newSellPrice; buyPrice = newBuyPrice; } /** * 使用以太币购买代币 */ function buy() payable public { uint amount = msg.value / buyPrice; _transfer(this, msg.sender, amount); } /** * @dev 卖出代币 * @return 要卖出的数量(单位是wei) */ function sell(uint256 amount) public { //检查合约的余额是否充足 require(this.balance >= amount * sellPrice); _transfer(msg.sender, this, amount); msg.sender.transfer(amount * sellPrice); } }
/** * 代币增发、 * 代币自动销售和购买、 * 高级代币功能 */
NatSpecMultiLine
setPrices
function setPrices(uint256 newSellPrice, uint256 newBuyPrice) onlyOwner public { sellPrice = newSellPrice; buyPrice = newBuyPrice; }
/** * 设置买卖价格 * * 如果你想让ether(或其他代币)为你的代币进行背书,以便可以市场价自动化买卖代币,我们可以这么做。如果要使用浮动的价格,也可以在这里设置 * * @param newSellPrice 新的卖出价格 * @param newBuyPrice 新的买入价格 */
NatSpecMultiLine
v0.4.16+commit.d7661dd9
MIT
bzzr://90d34bb66329f86d4171331463de8c9f346c57ccd941490586ed719dd3bf2eb1
{ "func_code_index": [ 1797, 1957 ] }
58,828
MyAdvancedToken
MyAdvancedToken.sol
0xb68b4bb27861dcdcad76e39323a4da62269586d4
Solidity
MyAdvancedToken
contract MyAdvancedToken is owned, TokenERC20 { //卖出的汇率,一个代币,可以卖出多少个以太币,单位是wei uint256 public sellPrice; //买入的汇率,1个以太币,可以买几个代币 uint256 public buyPrice; /*初始化合约,并且把初始的所有的令牌都给这合约的创建者 * @param initialSupply 所有币的总数 * @param tokenName 代币名称 * @param tokenSymbol 代币符号 */ function MyAdvancedToken( uint256 initialSupply, string tokenName, string tokenSymbol ) TokenERC20(initialSupply, tokenName, tokenSymbol) public {} /** * 私有方法,从指定帐户转出余额 * @param _from address 发送代币的地址 * @param _to address 接受代币的地址 * @param _value uint256 接受代币的数量 */ function _transfer(address _from, address _to, uint _value) internal { //避免转帐的地址是0x0 require (_to != 0x0); //检查发送者是否拥有足够余额 require (balanceOf[_from] > _value); //检查是否溢出 require (balanceOf[_to] + _value > balanceOf[_to]); //从发送者减掉发送额 balanceOf[_from] -= _value; //给接收者加上相同的量 balanceOf[_to] += _value; //通知任何监听该交易的客户端 Transfer(_from, _to, _value); } /** * 合约拥有者,可以为指定帐户创造一些代币 * @param target address 帐户地址 * @param mintedAmount uint256 增加的金额(单位是wei) */ function mintToken(address target, uint256 mintedAmount) onlyOwner public { //给指定地址增加代币,同时总量也相加 balanceOf[target] += mintedAmount; totalSupply += mintedAmount; Transfer(0, this, mintedAmount); Transfer(this, target, mintedAmount); } /** * 设置买卖价格 * * 如果你想让ether(或其他代币)为你的代币进行背书,以便可以市场价自动化买卖代币,我们可以这么做。如果要使用浮动的价格,也可以在这里设置 * * @param newSellPrice 新的卖出价格 * @param newBuyPrice 新的买入价格 */ function setPrices(uint256 newSellPrice, uint256 newBuyPrice) onlyOwner public { sellPrice = newSellPrice; buyPrice = newBuyPrice; } /** * 使用以太币购买代币 */ function buy() payable public { uint amount = msg.value / buyPrice; _transfer(this, msg.sender, amount); } /** * @dev 卖出代币 * @return 要卖出的数量(单位是wei) */ function sell(uint256 amount) public { //检查合约的余额是否充足 require(this.balance >= amount * sellPrice); _transfer(msg.sender, this, amount); msg.sender.transfer(amount * sellPrice); } }
/** * 代币增发、 * 代币自动销售和购买、 * 高级代币功能 */
NatSpecMultiLine
buy
function buy() payable public { uint amount = msg.value / buyPrice; _transfer(this, msg.sender, amount); }
/** * 使用以太币购买代币 */
NatSpecMultiLine
v0.4.16+commit.d7661dd9
MIT
bzzr://90d34bb66329f86d4171331463de8c9f346c57ccd941490586ed719dd3bf2eb1
{ "func_code_index": [ 1997, 2130 ] }
58,829
MyAdvancedToken
MyAdvancedToken.sol
0xb68b4bb27861dcdcad76e39323a4da62269586d4
Solidity
MyAdvancedToken
contract MyAdvancedToken is owned, TokenERC20 { //卖出的汇率,一个代币,可以卖出多少个以太币,单位是wei uint256 public sellPrice; //买入的汇率,1个以太币,可以买几个代币 uint256 public buyPrice; /*初始化合约,并且把初始的所有的令牌都给这合约的创建者 * @param initialSupply 所有币的总数 * @param tokenName 代币名称 * @param tokenSymbol 代币符号 */ function MyAdvancedToken( uint256 initialSupply, string tokenName, string tokenSymbol ) TokenERC20(initialSupply, tokenName, tokenSymbol) public {} /** * 私有方法,从指定帐户转出余额 * @param _from address 发送代币的地址 * @param _to address 接受代币的地址 * @param _value uint256 接受代币的数量 */ function _transfer(address _from, address _to, uint _value) internal { //避免转帐的地址是0x0 require (_to != 0x0); //检查发送者是否拥有足够余额 require (balanceOf[_from] > _value); //检查是否溢出 require (balanceOf[_to] + _value > balanceOf[_to]); //从发送者减掉发送额 balanceOf[_from] -= _value; //给接收者加上相同的量 balanceOf[_to] += _value; //通知任何监听该交易的客户端 Transfer(_from, _to, _value); } /** * 合约拥有者,可以为指定帐户创造一些代币 * @param target address 帐户地址 * @param mintedAmount uint256 增加的金额(单位是wei) */ function mintToken(address target, uint256 mintedAmount) onlyOwner public { //给指定地址增加代币,同时总量也相加 balanceOf[target] += mintedAmount; totalSupply += mintedAmount; Transfer(0, this, mintedAmount); Transfer(this, target, mintedAmount); } /** * 设置买卖价格 * * 如果你想让ether(或其他代币)为你的代币进行背书,以便可以市场价自动化买卖代币,我们可以这么做。如果要使用浮动的价格,也可以在这里设置 * * @param newSellPrice 新的卖出价格 * @param newBuyPrice 新的买入价格 */ function setPrices(uint256 newSellPrice, uint256 newBuyPrice) onlyOwner public { sellPrice = newSellPrice; buyPrice = newBuyPrice; } /** * 使用以太币购买代币 */ function buy() payable public { uint amount = msg.value / buyPrice; _transfer(this, msg.sender, amount); } /** * @dev 卖出代币 * @return 要卖出的数量(单位是wei) */ function sell(uint256 amount) public { //检查合约的余额是否充足 require(this.balance >= amount * sellPrice); _transfer(msg.sender, this, amount); msg.sender.transfer(amount * sellPrice); } }
/** * 代币增发、 * 代币自动销售和购买、 * 高级代币功能 */
NatSpecMultiLine
sell
function sell(uint256 amount) public { //检查合约的余额是否充足 require(this.balance >= amount * sellPrice); _transfer(msg.sender, this, amount); msg.sender.transfer(amount * sellPrice); }
/** * @dev 卖出代币 * @return 要卖出的数量(单位是wei) */
NatSpecMultiLine
v0.4.16+commit.d7661dd9
MIT
bzzr://90d34bb66329f86d4171331463de8c9f346c57ccd941490586ed719dd3bf2eb1
{ "func_code_index": [ 2201, 2433 ] }
58,830
RoboBitAI
RoboBitAI.sol
0xcc4f0effdb46729c047064372d0bb196d035896d
Solidity
RoboBitAI
contract RoboBitAI { // Public variables of the token string public name; string public symbol; uint8 public decimals = 8; // 18 decimals is the strongly suggested default, avoid changing it uint256 public totalSupply; // This creates an array with all balances mapping (address => uint256) public balanceOf; mapping (address => mapping (address => uint256)) public allowance; // This generates a public event on the blockchain that will notify clients event Transfer(address indexed from, address indexed to, uint256 value); // This generates a public event on the blockchain that will notify clients event Approval(address indexed _owner, address indexed _spender, uint256 _value); // This notifies clients about the amount burnt event Burn(address indexed from, uint256 value); /** * Constructor function * * Initializes contract with initial supply tokens to the creator of the contract */ constructor( uint256 initialSupply, string memory tokenName, string memory tokenSymbol ) public { totalSupply = 15000000000000000; // Update total supply with the decimal amount balanceOf[msg.sender] = totalSupply; // Give the creator all initial tokens name = "RoboBit AI"; // Set the name for display purposes symbol = "RBAI"; // Set the symbol for display purposes } /** * Internal transfer, only can be called by this contract */ function _transfer(address _from, address _to, uint _value) internal { // Prevent transfer to 0x0 address. Use burn() instead require(_to != address(0x0)); // Check if the sender has enough require(balanceOf[_from] >= _value); // Check for overflows require(balanceOf[_to] + _value >= balanceOf[_to]); // Save this for an assertion in the future uint previousBalances = balanceOf[_from] + balanceOf[_to]; // Subtract from the sender balanceOf[_from] -= _value; // Add the same to the recipient balanceOf[_to] += _value; emit Transfer(_from, _to, _value); // Asserts are used to use static analysis to find bugs in your code. They should never fail assert(balanceOf[_from] + balanceOf[_to] == previousBalances); } /** * Transfer tokens * * Send `_value` tokens to `_to` from your account * * @param _to The address of the recipient * @param _value the amount to send */ function transfer(address _to, uint256 _value) public returns (bool success) { _transfer(msg.sender, _to, _value); return true; } /** * Transfer tokens from other address * * Send `_value` tokens to `_to` on behalf of `_from` * * @param _from The address of the sender * @param _to The address of the recipient * @param _value the amount to send */ function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) { require(_value <= allowance[_from][msg.sender]); // Check allowance allowance[_from][msg.sender] -= _value; _transfer(_from, _to, _value); return true; } /** * Set allowance for other address * * Allows `_spender` to spend no more than `_value` tokens on your behalf * * @param _spender The address authorized to spend * @param _value the max amount they can spend */ function approve(address _spender, uint256 _value) public returns (bool success) { allowance[msg.sender][_spender] = _value; emit Approval(msg.sender, _spender, _value); return true; } /** * Set allowance for other address and notify * * Allows `_spender` to spend no more than `_value` tokens on your behalf, and then ping the contract about it * * @param _spender The address authorized to spend * @param _value the max amount they can spend * @param _extraData some extra information to send to the approved contract */ function approveAndCall(address _spender, uint256 _value, bytes memory _extraData) public returns (bool success) { tokenRecipient spender = tokenRecipient(_spender); if (approve(_spender, _value)) { spender.receiveApproval(msg.sender, _value, address(this), _extraData); return true; } } /** * Destroy tokens * * Remove `_value` tokens from the system irreversibly * * @param _value the amount of money to burn */ function burn(uint256 _value) public returns (bool success) { require(balanceOf[msg.sender] >= _value); // Check if the sender has enough balanceOf[msg.sender] -= _value; // Subtract from the sender totalSupply -= _value; // Updates totalSupply emit Burn(msg.sender, _value); return true; } /** * Destroy tokens from other account * * Remove `_value` tokens from the system irreversibly on behalf of `_from`. * * @param _from the address of the sender * @param _value the amount of money to burn */ function burnFrom(address _from, uint256 _value) public returns (bool success) { require(balanceOf[_from] >= _value); // Check if the targeted balance is enough require(_value <= allowance[_from][msg.sender]); // Check allowance balanceOf[_from] -= _value; // Subtract from the targeted balance allowance[_from][msg.sender] -= _value; // Subtract from the sender's allowance totalSupply -= _value; // Update totalSupply emit Burn(_from, _value); return true; } }
_transfer
function _transfer(address _from, address _to, uint _value) internal { // Prevent transfer to 0x0 address. Use burn() instead require(_to != address(0x0)); // Check if the sender has enough require(balanceOf[_from] >= _value); // Check for overflows require(balanceOf[_to] + _value >= balanceOf[_to]); // Save this for an assertion in the future uint previousBalances = balanceOf[_from] + balanceOf[_to]; // Subtract from the sender balanceOf[_from] -= _value; // Add the same to the recipient balanceOf[_to] += _value; emit Transfer(_from, _to, _value); // Asserts are used to use static analysis to find bugs in your code. They should never fail assert(balanceOf[_from] + balanceOf[_to] == previousBalances); }
/** * Internal transfer, only can be called by this contract */
NatSpecMultiLine
v0.5.15+commit.6a57276f
MIT
bzzr://9c7939f932ee510bdcb56b77153098ef6e8cbc82e6b10e9c811209c242d09e14
{ "func_code_index": [ 1624, 2481 ] }
58,831
RoboBitAI
RoboBitAI.sol
0xcc4f0effdb46729c047064372d0bb196d035896d
Solidity
RoboBitAI
contract RoboBitAI { // Public variables of the token string public name; string public symbol; uint8 public decimals = 8; // 18 decimals is the strongly suggested default, avoid changing it uint256 public totalSupply; // This creates an array with all balances mapping (address => uint256) public balanceOf; mapping (address => mapping (address => uint256)) public allowance; // This generates a public event on the blockchain that will notify clients event Transfer(address indexed from, address indexed to, uint256 value); // This generates a public event on the blockchain that will notify clients event Approval(address indexed _owner, address indexed _spender, uint256 _value); // This notifies clients about the amount burnt event Burn(address indexed from, uint256 value); /** * Constructor function * * Initializes contract with initial supply tokens to the creator of the contract */ constructor( uint256 initialSupply, string memory tokenName, string memory tokenSymbol ) public { totalSupply = 15000000000000000; // Update total supply with the decimal amount balanceOf[msg.sender] = totalSupply; // Give the creator all initial tokens name = "RoboBit AI"; // Set the name for display purposes symbol = "RBAI"; // Set the symbol for display purposes } /** * Internal transfer, only can be called by this contract */ function _transfer(address _from, address _to, uint _value) internal { // Prevent transfer to 0x0 address. Use burn() instead require(_to != address(0x0)); // Check if the sender has enough require(balanceOf[_from] >= _value); // Check for overflows require(balanceOf[_to] + _value >= balanceOf[_to]); // Save this for an assertion in the future uint previousBalances = balanceOf[_from] + balanceOf[_to]; // Subtract from the sender balanceOf[_from] -= _value; // Add the same to the recipient balanceOf[_to] += _value; emit Transfer(_from, _to, _value); // Asserts are used to use static analysis to find bugs in your code. They should never fail assert(balanceOf[_from] + balanceOf[_to] == previousBalances); } /** * Transfer tokens * * Send `_value` tokens to `_to` from your account * * @param _to The address of the recipient * @param _value the amount to send */ function transfer(address _to, uint256 _value) public returns (bool success) { _transfer(msg.sender, _to, _value); return true; } /** * Transfer tokens from other address * * Send `_value` tokens to `_to` on behalf of `_from` * * @param _from The address of the sender * @param _to The address of the recipient * @param _value the amount to send */ function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) { require(_value <= allowance[_from][msg.sender]); // Check allowance allowance[_from][msg.sender] -= _value; _transfer(_from, _to, _value); return true; } /** * Set allowance for other address * * Allows `_spender` to spend no more than `_value` tokens on your behalf * * @param _spender The address authorized to spend * @param _value the max amount they can spend */ function approve(address _spender, uint256 _value) public returns (bool success) { allowance[msg.sender][_spender] = _value; emit Approval(msg.sender, _spender, _value); return true; } /** * Set allowance for other address and notify * * Allows `_spender` to spend no more than `_value` tokens on your behalf, and then ping the contract about it * * @param _spender The address authorized to spend * @param _value the max amount they can spend * @param _extraData some extra information to send to the approved contract */ function approveAndCall(address _spender, uint256 _value, bytes memory _extraData) public returns (bool success) { tokenRecipient spender = tokenRecipient(_spender); if (approve(_spender, _value)) { spender.receiveApproval(msg.sender, _value, address(this), _extraData); return true; } } /** * Destroy tokens * * Remove `_value` tokens from the system irreversibly * * @param _value the amount of money to burn */ function burn(uint256 _value) public returns (bool success) { require(balanceOf[msg.sender] >= _value); // Check if the sender has enough balanceOf[msg.sender] -= _value; // Subtract from the sender totalSupply -= _value; // Updates totalSupply emit Burn(msg.sender, _value); return true; } /** * Destroy tokens from other account * * Remove `_value` tokens from the system irreversibly on behalf of `_from`. * * @param _from the address of the sender * @param _value the amount of money to burn */ function burnFrom(address _from, uint256 _value) public returns (bool success) { require(balanceOf[_from] >= _value); // Check if the targeted balance is enough require(_value <= allowance[_from][msg.sender]); // Check allowance balanceOf[_from] -= _value; // Subtract from the targeted balance allowance[_from][msg.sender] -= _value; // Subtract from the sender's allowance totalSupply -= _value; // Update totalSupply emit Burn(_from, _value); return true; } }
transfer
function transfer(address _to, uint256 _value) public returns (bool success) { _transfer(msg.sender, _to, _value); return true; }
/** * Transfer tokens * * Send `_value` tokens to `_to` from your account * * @param _to The address of the recipient * @param _value the amount to send */
NatSpecMultiLine
v0.5.15+commit.6a57276f
MIT
bzzr://9c7939f932ee510bdcb56b77153098ef6e8cbc82e6b10e9c811209c242d09e14
{ "func_code_index": [ 2687, 2844 ] }
58,832
RoboBitAI
RoboBitAI.sol
0xcc4f0effdb46729c047064372d0bb196d035896d
Solidity
RoboBitAI
contract RoboBitAI { // Public variables of the token string public name; string public symbol; uint8 public decimals = 8; // 18 decimals is the strongly suggested default, avoid changing it uint256 public totalSupply; // This creates an array with all balances mapping (address => uint256) public balanceOf; mapping (address => mapping (address => uint256)) public allowance; // This generates a public event on the blockchain that will notify clients event Transfer(address indexed from, address indexed to, uint256 value); // This generates a public event on the blockchain that will notify clients event Approval(address indexed _owner, address indexed _spender, uint256 _value); // This notifies clients about the amount burnt event Burn(address indexed from, uint256 value); /** * Constructor function * * Initializes contract with initial supply tokens to the creator of the contract */ constructor( uint256 initialSupply, string memory tokenName, string memory tokenSymbol ) public { totalSupply = 15000000000000000; // Update total supply with the decimal amount balanceOf[msg.sender] = totalSupply; // Give the creator all initial tokens name = "RoboBit AI"; // Set the name for display purposes symbol = "RBAI"; // Set the symbol for display purposes } /** * Internal transfer, only can be called by this contract */ function _transfer(address _from, address _to, uint _value) internal { // Prevent transfer to 0x0 address. Use burn() instead require(_to != address(0x0)); // Check if the sender has enough require(balanceOf[_from] >= _value); // Check for overflows require(balanceOf[_to] + _value >= balanceOf[_to]); // Save this for an assertion in the future uint previousBalances = balanceOf[_from] + balanceOf[_to]; // Subtract from the sender balanceOf[_from] -= _value; // Add the same to the recipient balanceOf[_to] += _value; emit Transfer(_from, _to, _value); // Asserts are used to use static analysis to find bugs in your code. They should never fail assert(balanceOf[_from] + balanceOf[_to] == previousBalances); } /** * Transfer tokens * * Send `_value` tokens to `_to` from your account * * @param _to The address of the recipient * @param _value the amount to send */ function transfer(address _to, uint256 _value) public returns (bool success) { _transfer(msg.sender, _to, _value); return true; } /** * Transfer tokens from other address * * Send `_value` tokens to `_to` on behalf of `_from` * * @param _from The address of the sender * @param _to The address of the recipient * @param _value the amount to send */ function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) { require(_value <= allowance[_from][msg.sender]); // Check allowance allowance[_from][msg.sender] -= _value; _transfer(_from, _to, _value); return true; } /** * Set allowance for other address * * Allows `_spender` to spend no more than `_value` tokens on your behalf * * @param _spender The address authorized to spend * @param _value the max amount they can spend */ function approve(address _spender, uint256 _value) public returns (bool success) { allowance[msg.sender][_spender] = _value; emit Approval(msg.sender, _spender, _value); return true; } /** * Set allowance for other address and notify * * Allows `_spender` to spend no more than `_value` tokens on your behalf, and then ping the contract about it * * @param _spender The address authorized to spend * @param _value the max amount they can spend * @param _extraData some extra information to send to the approved contract */ function approveAndCall(address _spender, uint256 _value, bytes memory _extraData) public returns (bool success) { tokenRecipient spender = tokenRecipient(_spender); if (approve(_spender, _value)) { spender.receiveApproval(msg.sender, _value, address(this), _extraData); return true; } } /** * Destroy tokens * * Remove `_value` tokens from the system irreversibly * * @param _value the amount of money to burn */ function burn(uint256 _value) public returns (bool success) { require(balanceOf[msg.sender] >= _value); // Check if the sender has enough balanceOf[msg.sender] -= _value; // Subtract from the sender totalSupply -= _value; // Updates totalSupply emit Burn(msg.sender, _value); return true; } /** * Destroy tokens from other account * * Remove `_value` tokens from the system irreversibly on behalf of `_from`. * * @param _from the address of the sender * @param _value the amount of money to burn */ function burnFrom(address _from, uint256 _value) public returns (bool success) { require(balanceOf[_from] >= _value); // Check if the targeted balance is enough require(_value <= allowance[_from][msg.sender]); // Check allowance balanceOf[_from] -= _value; // Subtract from the targeted balance allowance[_from][msg.sender] -= _value; // Subtract from the sender's allowance totalSupply -= _value; // Update totalSupply emit Burn(_from, _value); return true; } }
transferFrom
function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) { require(_value <= allowance[_from][msg.sender]); // Check allowance allowance[_from][msg.sender] -= _value; _transfer(_from, _to, _value); return true; }
/** * Transfer tokens from other address * * Send `_value` tokens to `_to` on behalf of `_from` * * @param _from The address of the sender * @param _to The address of the recipient * @param _value the amount to send */
NatSpecMultiLine
v0.5.15+commit.6a57276f
MIT
bzzr://9c7939f932ee510bdcb56b77153098ef6e8cbc82e6b10e9c811209c242d09e14
{ "func_code_index": [ 3119, 3420 ] }
58,833
RoboBitAI
RoboBitAI.sol
0xcc4f0effdb46729c047064372d0bb196d035896d
Solidity
RoboBitAI
contract RoboBitAI { // Public variables of the token string public name; string public symbol; uint8 public decimals = 8; // 18 decimals is the strongly suggested default, avoid changing it uint256 public totalSupply; // This creates an array with all balances mapping (address => uint256) public balanceOf; mapping (address => mapping (address => uint256)) public allowance; // This generates a public event on the blockchain that will notify clients event Transfer(address indexed from, address indexed to, uint256 value); // This generates a public event on the blockchain that will notify clients event Approval(address indexed _owner, address indexed _spender, uint256 _value); // This notifies clients about the amount burnt event Burn(address indexed from, uint256 value); /** * Constructor function * * Initializes contract with initial supply tokens to the creator of the contract */ constructor( uint256 initialSupply, string memory tokenName, string memory tokenSymbol ) public { totalSupply = 15000000000000000; // Update total supply with the decimal amount balanceOf[msg.sender] = totalSupply; // Give the creator all initial tokens name = "RoboBit AI"; // Set the name for display purposes symbol = "RBAI"; // Set the symbol for display purposes } /** * Internal transfer, only can be called by this contract */ function _transfer(address _from, address _to, uint _value) internal { // Prevent transfer to 0x0 address. Use burn() instead require(_to != address(0x0)); // Check if the sender has enough require(balanceOf[_from] >= _value); // Check for overflows require(balanceOf[_to] + _value >= balanceOf[_to]); // Save this for an assertion in the future uint previousBalances = balanceOf[_from] + balanceOf[_to]; // Subtract from the sender balanceOf[_from] -= _value; // Add the same to the recipient balanceOf[_to] += _value; emit Transfer(_from, _to, _value); // Asserts are used to use static analysis to find bugs in your code. They should never fail assert(balanceOf[_from] + balanceOf[_to] == previousBalances); } /** * Transfer tokens * * Send `_value` tokens to `_to` from your account * * @param _to The address of the recipient * @param _value the amount to send */ function transfer(address _to, uint256 _value) public returns (bool success) { _transfer(msg.sender, _to, _value); return true; } /** * Transfer tokens from other address * * Send `_value` tokens to `_to` on behalf of `_from` * * @param _from The address of the sender * @param _to The address of the recipient * @param _value the amount to send */ function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) { require(_value <= allowance[_from][msg.sender]); // Check allowance allowance[_from][msg.sender] -= _value; _transfer(_from, _to, _value); return true; } /** * Set allowance for other address * * Allows `_spender` to spend no more than `_value` tokens on your behalf * * @param _spender The address authorized to spend * @param _value the max amount they can spend */ function approve(address _spender, uint256 _value) public returns (bool success) { allowance[msg.sender][_spender] = _value; emit Approval(msg.sender, _spender, _value); return true; } /** * Set allowance for other address and notify * * Allows `_spender` to spend no more than `_value` tokens on your behalf, and then ping the contract about it * * @param _spender The address authorized to spend * @param _value the max amount they can spend * @param _extraData some extra information to send to the approved contract */ function approveAndCall(address _spender, uint256 _value, bytes memory _extraData) public returns (bool success) { tokenRecipient spender = tokenRecipient(_spender); if (approve(_spender, _value)) { spender.receiveApproval(msg.sender, _value, address(this), _extraData); return true; } } /** * Destroy tokens * * Remove `_value` tokens from the system irreversibly * * @param _value the amount of money to burn */ function burn(uint256 _value) public returns (bool success) { require(balanceOf[msg.sender] >= _value); // Check if the sender has enough balanceOf[msg.sender] -= _value; // Subtract from the sender totalSupply -= _value; // Updates totalSupply emit Burn(msg.sender, _value); return true; } /** * Destroy tokens from other account * * Remove `_value` tokens from the system irreversibly on behalf of `_from`. * * @param _from the address of the sender * @param _value the amount of money to burn */ function burnFrom(address _from, uint256 _value) public returns (bool success) { require(balanceOf[_from] >= _value); // Check if the targeted balance is enough require(_value <= allowance[_from][msg.sender]); // Check allowance balanceOf[_from] -= _value; // Subtract from the targeted balance allowance[_from][msg.sender] -= _value; // Subtract from the sender's allowance totalSupply -= _value; // Update totalSupply emit Burn(_from, _value); return true; } }
approve
function approve(address _spender, uint256 _value) public returns (bool success) { allowance[msg.sender][_spender] = _value; emit Approval(msg.sender, _spender, _value); return true; }
/** * Set allowance for other address * * Allows `_spender` to spend no more than `_value` tokens on your behalf * * @param _spender The address authorized to spend * @param _value the max amount they can spend */
NatSpecMultiLine
v0.5.15+commit.6a57276f
MIT
bzzr://9c7939f932ee510bdcb56b77153098ef6e8cbc82e6b10e9c811209c242d09e14
{ "func_code_index": [ 3684, 3914 ] }
58,834
RoboBitAI
RoboBitAI.sol
0xcc4f0effdb46729c047064372d0bb196d035896d
Solidity
RoboBitAI
contract RoboBitAI { // Public variables of the token string public name; string public symbol; uint8 public decimals = 8; // 18 decimals is the strongly suggested default, avoid changing it uint256 public totalSupply; // This creates an array with all balances mapping (address => uint256) public balanceOf; mapping (address => mapping (address => uint256)) public allowance; // This generates a public event on the blockchain that will notify clients event Transfer(address indexed from, address indexed to, uint256 value); // This generates a public event on the blockchain that will notify clients event Approval(address indexed _owner, address indexed _spender, uint256 _value); // This notifies clients about the amount burnt event Burn(address indexed from, uint256 value); /** * Constructor function * * Initializes contract with initial supply tokens to the creator of the contract */ constructor( uint256 initialSupply, string memory tokenName, string memory tokenSymbol ) public { totalSupply = 15000000000000000; // Update total supply with the decimal amount balanceOf[msg.sender] = totalSupply; // Give the creator all initial tokens name = "RoboBit AI"; // Set the name for display purposes symbol = "RBAI"; // Set the symbol for display purposes } /** * Internal transfer, only can be called by this contract */ function _transfer(address _from, address _to, uint _value) internal { // Prevent transfer to 0x0 address. Use burn() instead require(_to != address(0x0)); // Check if the sender has enough require(balanceOf[_from] >= _value); // Check for overflows require(balanceOf[_to] + _value >= balanceOf[_to]); // Save this for an assertion in the future uint previousBalances = balanceOf[_from] + balanceOf[_to]; // Subtract from the sender balanceOf[_from] -= _value; // Add the same to the recipient balanceOf[_to] += _value; emit Transfer(_from, _to, _value); // Asserts are used to use static analysis to find bugs in your code. They should never fail assert(balanceOf[_from] + balanceOf[_to] == previousBalances); } /** * Transfer tokens * * Send `_value` tokens to `_to` from your account * * @param _to The address of the recipient * @param _value the amount to send */ function transfer(address _to, uint256 _value) public returns (bool success) { _transfer(msg.sender, _to, _value); return true; } /** * Transfer tokens from other address * * Send `_value` tokens to `_to` on behalf of `_from` * * @param _from The address of the sender * @param _to The address of the recipient * @param _value the amount to send */ function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) { require(_value <= allowance[_from][msg.sender]); // Check allowance allowance[_from][msg.sender] -= _value; _transfer(_from, _to, _value); return true; } /** * Set allowance for other address * * Allows `_spender` to spend no more than `_value` tokens on your behalf * * @param _spender The address authorized to spend * @param _value the max amount they can spend */ function approve(address _spender, uint256 _value) public returns (bool success) { allowance[msg.sender][_spender] = _value; emit Approval(msg.sender, _spender, _value); return true; } /** * Set allowance for other address and notify * * Allows `_spender` to spend no more than `_value` tokens on your behalf, and then ping the contract about it * * @param _spender The address authorized to spend * @param _value the max amount they can spend * @param _extraData some extra information to send to the approved contract */ function approveAndCall(address _spender, uint256 _value, bytes memory _extraData) public returns (bool success) { tokenRecipient spender = tokenRecipient(_spender); if (approve(_spender, _value)) { spender.receiveApproval(msg.sender, _value, address(this), _extraData); return true; } } /** * Destroy tokens * * Remove `_value` tokens from the system irreversibly * * @param _value the amount of money to burn */ function burn(uint256 _value) public returns (bool success) { require(balanceOf[msg.sender] >= _value); // Check if the sender has enough balanceOf[msg.sender] -= _value; // Subtract from the sender totalSupply -= _value; // Updates totalSupply emit Burn(msg.sender, _value); return true; } /** * Destroy tokens from other account * * Remove `_value` tokens from the system irreversibly on behalf of `_from`. * * @param _from the address of the sender * @param _value the amount of money to burn */ function burnFrom(address _from, uint256 _value) public returns (bool success) { require(balanceOf[_from] >= _value); // Check if the targeted balance is enough require(_value <= allowance[_from][msg.sender]); // Check allowance balanceOf[_from] -= _value; // Subtract from the targeted balance allowance[_from][msg.sender] -= _value; // Subtract from the sender's allowance totalSupply -= _value; // Update totalSupply emit Burn(_from, _value); return true; } }
approveAndCall
function approveAndCall(address _spender, uint256 _value, bytes memory _extraData) public returns (bool success) { tokenRecipient spender = tokenRecipient(_spender); if (approve(_spender, _value)) { spender.receiveApproval(msg.sender, _value, address(this), _extraData); return true; } }
/** * Set allowance for other address and notify * * Allows `_spender` to spend no more than `_value` tokens on your behalf, and then ping the contract about it * * @param _spender The address authorized to spend * @param _value the max amount they can spend * @param _extraData some extra information to send to the approved contract */
NatSpecMultiLine
v0.5.15+commit.6a57276f
MIT
bzzr://9c7939f932ee510bdcb56b77153098ef6e8cbc82e6b10e9c811209c242d09e14
{ "func_code_index": [ 4308, 4676 ] }
58,835
RoboBitAI
RoboBitAI.sol
0xcc4f0effdb46729c047064372d0bb196d035896d
Solidity
RoboBitAI
contract RoboBitAI { // Public variables of the token string public name; string public symbol; uint8 public decimals = 8; // 18 decimals is the strongly suggested default, avoid changing it uint256 public totalSupply; // This creates an array with all balances mapping (address => uint256) public balanceOf; mapping (address => mapping (address => uint256)) public allowance; // This generates a public event on the blockchain that will notify clients event Transfer(address indexed from, address indexed to, uint256 value); // This generates a public event on the blockchain that will notify clients event Approval(address indexed _owner, address indexed _spender, uint256 _value); // This notifies clients about the amount burnt event Burn(address indexed from, uint256 value); /** * Constructor function * * Initializes contract with initial supply tokens to the creator of the contract */ constructor( uint256 initialSupply, string memory tokenName, string memory tokenSymbol ) public { totalSupply = 15000000000000000; // Update total supply with the decimal amount balanceOf[msg.sender] = totalSupply; // Give the creator all initial tokens name = "RoboBit AI"; // Set the name for display purposes symbol = "RBAI"; // Set the symbol for display purposes } /** * Internal transfer, only can be called by this contract */ function _transfer(address _from, address _to, uint _value) internal { // Prevent transfer to 0x0 address. Use burn() instead require(_to != address(0x0)); // Check if the sender has enough require(balanceOf[_from] >= _value); // Check for overflows require(balanceOf[_to] + _value >= balanceOf[_to]); // Save this for an assertion in the future uint previousBalances = balanceOf[_from] + balanceOf[_to]; // Subtract from the sender balanceOf[_from] -= _value; // Add the same to the recipient balanceOf[_to] += _value; emit Transfer(_from, _to, _value); // Asserts are used to use static analysis to find bugs in your code. They should never fail assert(balanceOf[_from] + balanceOf[_to] == previousBalances); } /** * Transfer tokens * * Send `_value` tokens to `_to` from your account * * @param _to The address of the recipient * @param _value the amount to send */ function transfer(address _to, uint256 _value) public returns (bool success) { _transfer(msg.sender, _to, _value); return true; } /** * Transfer tokens from other address * * Send `_value` tokens to `_to` on behalf of `_from` * * @param _from The address of the sender * @param _to The address of the recipient * @param _value the amount to send */ function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) { require(_value <= allowance[_from][msg.sender]); // Check allowance allowance[_from][msg.sender] -= _value; _transfer(_from, _to, _value); return true; } /** * Set allowance for other address * * Allows `_spender` to spend no more than `_value` tokens on your behalf * * @param _spender The address authorized to spend * @param _value the max amount they can spend */ function approve(address _spender, uint256 _value) public returns (bool success) { allowance[msg.sender][_spender] = _value; emit Approval(msg.sender, _spender, _value); return true; } /** * Set allowance for other address and notify * * Allows `_spender` to spend no more than `_value` tokens on your behalf, and then ping the contract about it * * @param _spender The address authorized to spend * @param _value the max amount they can spend * @param _extraData some extra information to send to the approved contract */ function approveAndCall(address _spender, uint256 _value, bytes memory _extraData) public returns (bool success) { tokenRecipient spender = tokenRecipient(_spender); if (approve(_spender, _value)) { spender.receiveApproval(msg.sender, _value, address(this), _extraData); return true; } } /** * Destroy tokens * * Remove `_value` tokens from the system irreversibly * * @param _value the amount of money to burn */ function burn(uint256 _value) public returns (bool success) { require(balanceOf[msg.sender] >= _value); // Check if the sender has enough balanceOf[msg.sender] -= _value; // Subtract from the sender totalSupply -= _value; // Updates totalSupply emit Burn(msg.sender, _value); return true; } /** * Destroy tokens from other account * * Remove `_value` tokens from the system irreversibly on behalf of `_from`. * * @param _from the address of the sender * @param _value the amount of money to burn */ function burnFrom(address _from, uint256 _value) public returns (bool success) { require(balanceOf[_from] >= _value); // Check if the targeted balance is enough require(_value <= allowance[_from][msg.sender]); // Check allowance balanceOf[_from] -= _value; // Subtract from the targeted balance allowance[_from][msg.sender] -= _value; // Subtract from the sender's allowance totalSupply -= _value; // Update totalSupply emit Burn(_from, _value); return true; } }
burn
function burn(uint256 _value) public returns (bool success) { require(balanceOf[msg.sender] >= _value); // Check if the sender has enough balanceOf[msg.sender] -= _value; // Subtract from the sender totalSupply -= _value; // Updates totalSupply emit Burn(msg.sender, _value); return true; }
/** * Destroy tokens * * Remove `_value` tokens from the system irreversibly * * @param _value the amount of money to burn */
NatSpecMultiLine
v0.5.15+commit.6a57276f
MIT
bzzr://9c7939f932ee510bdcb56b77153098ef6e8cbc82e6b10e9c811209c242d09e14
{ "func_code_index": [ 4846, 5225 ] }
58,836
RoboBitAI
RoboBitAI.sol
0xcc4f0effdb46729c047064372d0bb196d035896d
Solidity
RoboBitAI
contract RoboBitAI { // Public variables of the token string public name; string public symbol; uint8 public decimals = 8; // 18 decimals is the strongly suggested default, avoid changing it uint256 public totalSupply; // This creates an array with all balances mapping (address => uint256) public balanceOf; mapping (address => mapping (address => uint256)) public allowance; // This generates a public event on the blockchain that will notify clients event Transfer(address indexed from, address indexed to, uint256 value); // This generates a public event on the blockchain that will notify clients event Approval(address indexed _owner, address indexed _spender, uint256 _value); // This notifies clients about the amount burnt event Burn(address indexed from, uint256 value); /** * Constructor function * * Initializes contract with initial supply tokens to the creator of the contract */ constructor( uint256 initialSupply, string memory tokenName, string memory tokenSymbol ) public { totalSupply = 15000000000000000; // Update total supply with the decimal amount balanceOf[msg.sender] = totalSupply; // Give the creator all initial tokens name = "RoboBit AI"; // Set the name for display purposes symbol = "RBAI"; // Set the symbol for display purposes } /** * Internal transfer, only can be called by this contract */ function _transfer(address _from, address _to, uint _value) internal { // Prevent transfer to 0x0 address. Use burn() instead require(_to != address(0x0)); // Check if the sender has enough require(balanceOf[_from] >= _value); // Check for overflows require(balanceOf[_to] + _value >= balanceOf[_to]); // Save this for an assertion in the future uint previousBalances = balanceOf[_from] + balanceOf[_to]; // Subtract from the sender balanceOf[_from] -= _value; // Add the same to the recipient balanceOf[_to] += _value; emit Transfer(_from, _to, _value); // Asserts are used to use static analysis to find bugs in your code. They should never fail assert(balanceOf[_from] + balanceOf[_to] == previousBalances); } /** * Transfer tokens * * Send `_value` tokens to `_to` from your account * * @param _to The address of the recipient * @param _value the amount to send */ function transfer(address _to, uint256 _value) public returns (bool success) { _transfer(msg.sender, _to, _value); return true; } /** * Transfer tokens from other address * * Send `_value` tokens to `_to` on behalf of `_from` * * @param _from The address of the sender * @param _to The address of the recipient * @param _value the amount to send */ function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) { require(_value <= allowance[_from][msg.sender]); // Check allowance allowance[_from][msg.sender] -= _value; _transfer(_from, _to, _value); return true; } /** * Set allowance for other address * * Allows `_spender` to spend no more than `_value` tokens on your behalf * * @param _spender The address authorized to spend * @param _value the max amount they can spend */ function approve(address _spender, uint256 _value) public returns (bool success) { allowance[msg.sender][_spender] = _value; emit Approval(msg.sender, _spender, _value); return true; } /** * Set allowance for other address and notify * * Allows `_spender` to spend no more than `_value` tokens on your behalf, and then ping the contract about it * * @param _spender The address authorized to spend * @param _value the max amount they can spend * @param _extraData some extra information to send to the approved contract */ function approveAndCall(address _spender, uint256 _value, bytes memory _extraData) public returns (bool success) { tokenRecipient spender = tokenRecipient(_spender); if (approve(_spender, _value)) { spender.receiveApproval(msg.sender, _value, address(this), _extraData); return true; } } /** * Destroy tokens * * Remove `_value` tokens from the system irreversibly * * @param _value the amount of money to burn */ function burn(uint256 _value) public returns (bool success) { require(balanceOf[msg.sender] >= _value); // Check if the sender has enough balanceOf[msg.sender] -= _value; // Subtract from the sender totalSupply -= _value; // Updates totalSupply emit Burn(msg.sender, _value); return true; } /** * Destroy tokens from other account * * Remove `_value` tokens from the system irreversibly on behalf of `_from`. * * @param _from the address of the sender * @param _value the amount of money to burn */ function burnFrom(address _from, uint256 _value) public returns (bool success) { require(balanceOf[_from] >= _value); // Check if the targeted balance is enough require(_value <= allowance[_from][msg.sender]); // Check allowance balanceOf[_from] -= _value; // Subtract from the targeted balance allowance[_from][msg.sender] -= _value; // Subtract from the sender's allowance totalSupply -= _value; // Update totalSupply emit Burn(_from, _value); return true; } }
burnFrom
function burnFrom(address _from, uint256 _value) public returns (bool success) { require(balanceOf[_from] >= _value); // Check if the targeted balance is enough require(_value <= allowance[_from][msg.sender]); // Check allowance balanceOf[_from] -= _value; // Subtract from the targeted balance allowance[_from][msg.sender] -= _value; // Subtract from the sender's allowance totalSupply -= _value; // Update totalSupply emit Burn(_from, _value); return true; }
/** * Destroy tokens from other account * * Remove `_value` tokens from the system irreversibly on behalf of `_from`. * * @param _from the address of the sender * @param _value the amount of money to burn */
NatSpecMultiLine
v0.5.15+commit.6a57276f
MIT
bzzr://9c7939f932ee510bdcb56b77153098ef6e8cbc82e6b10e9c811209c242d09e14
{ "func_code_index": [ 5483, 6099 ] }
58,837
AddressProvider
AddressProvider.sol
0x6fae125de41c03fa7d917ccfa17ba54ef4feb014
Solidity
IVaultsCore
interface IVaultsCore { event Opened(uint256 indexed vaultId, address indexed collateralType, address indexed owner); event Deposited(uint256 indexed vaultId, uint256 amount, address indexed sender); event Withdrawn(uint256 indexed vaultId, uint256 amount, address indexed sender); event Borrowed(uint256 indexed vaultId, uint256 amount, address indexed sender); event Repaid(uint256 indexed vaultId, uint256 amount, address indexed sender); event Liquidated( uint256 indexed vaultId, uint256 debtRepaid, uint256 collateralLiquidated, address indexed owner, address indexed sender ); event CumulativeRateUpdated( address indexed collateralType, uint256 elapsedTime, uint256 newCumulativeRate ); //cumulative interest rate from deployment time T0 event InsurancePaid(uint256 indexed vaultId, uint256 insuranceAmount, address indexed sender); function a() external view returns (IAddressProvider); function deposit(address _collateralType, uint256 _amount) external; function withdraw(uint256 _vaultId, uint256 _amount) external; function withdrawAll(uint256 _vaultId) external; function borrow(uint256 _vaultId, uint256 _amount) external; function repayAll(uint256 _vaultId) external; function repay(uint256 _vaultId, uint256 _amount) external; function liquidate(uint256 _vaultId) external; //Read only function availableIncome() external view returns (uint256); function cumulativeRates(address _collateralType) external view returns (uint256); function lastRefresh(address _collateralType) external view returns (uint256); //Refresh function initializeRates(address _collateralType) external; function refresh() external; function refreshCollateral(address collateralType) external; //upgrade function upgrade(address _newVaultsCore) external; }
//
LineComment
availableIncome
function availableIncome() external view returns (uint256);
//Read only
LineComment
v0.6.12+commit.27d51765
MIT
{ "func_code_index": [ 1385, 1446 ] }
58,838
AddressProvider
AddressProvider.sol
0x6fae125de41c03fa7d917ccfa17ba54ef4feb014
Solidity
IVaultsCore
interface IVaultsCore { event Opened(uint256 indexed vaultId, address indexed collateralType, address indexed owner); event Deposited(uint256 indexed vaultId, uint256 amount, address indexed sender); event Withdrawn(uint256 indexed vaultId, uint256 amount, address indexed sender); event Borrowed(uint256 indexed vaultId, uint256 amount, address indexed sender); event Repaid(uint256 indexed vaultId, uint256 amount, address indexed sender); event Liquidated( uint256 indexed vaultId, uint256 debtRepaid, uint256 collateralLiquidated, address indexed owner, address indexed sender ); event CumulativeRateUpdated( address indexed collateralType, uint256 elapsedTime, uint256 newCumulativeRate ); //cumulative interest rate from deployment time T0 event InsurancePaid(uint256 indexed vaultId, uint256 insuranceAmount, address indexed sender); function a() external view returns (IAddressProvider); function deposit(address _collateralType, uint256 _amount) external; function withdraw(uint256 _vaultId, uint256 _amount) external; function withdrawAll(uint256 _vaultId) external; function borrow(uint256 _vaultId, uint256 _amount) external; function repayAll(uint256 _vaultId) external; function repay(uint256 _vaultId, uint256 _amount) external; function liquidate(uint256 _vaultId) external; //Read only function availableIncome() external view returns (uint256); function cumulativeRates(address _collateralType) external view returns (uint256); function lastRefresh(address _collateralType) external view returns (uint256); //Refresh function initializeRates(address _collateralType) external; function refresh() external; function refreshCollateral(address collateralType) external; //upgrade function upgrade(address _newVaultsCore) external; }
//
LineComment
initializeRates
function initializeRates(address _collateralType) external;
//Refresh
LineComment
v0.6.12+commit.27d51765
MIT
{ "func_code_index": [ 1628, 1689 ] }
58,839
AddressProvider
AddressProvider.sol
0x6fae125de41c03fa7d917ccfa17ba54ef4feb014
Solidity
IVaultsCore
interface IVaultsCore { event Opened(uint256 indexed vaultId, address indexed collateralType, address indexed owner); event Deposited(uint256 indexed vaultId, uint256 amount, address indexed sender); event Withdrawn(uint256 indexed vaultId, uint256 amount, address indexed sender); event Borrowed(uint256 indexed vaultId, uint256 amount, address indexed sender); event Repaid(uint256 indexed vaultId, uint256 amount, address indexed sender); event Liquidated( uint256 indexed vaultId, uint256 debtRepaid, uint256 collateralLiquidated, address indexed owner, address indexed sender ); event CumulativeRateUpdated( address indexed collateralType, uint256 elapsedTime, uint256 newCumulativeRate ); //cumulative interest rate from deployment time T0 event InsurancePaid(uint256 indexed vaultId, uint256 insuranceAmount, address indexed sender); function a() external view returns (IAddressProvider); function deposit(address _collateralType, uint256 _amount) external; function withdraw(uint256 _vaultId, uint256 _amount) external; function withdrawAll(uint256 _vaultId) external; function borrow(uint256 _vaultId, uint256 _amount) external; function repayAll(uint256 _vaultId) external; function repay(uint256 _vaultId, uint256 _amount) external; function liquidate(uint256 _vaultId) external; //Read only function availableIncome() external view returns (uint256); function cumulativeRates(address _collateralType) external view returns (uint256); function lastRefresh(address _collateralType) external view returns (uint256); //Refresh function initializeRates(address _collateralType) external; function refresh() external; function refreshCollateral(address collateralType) external; //upgrade function upgrade(address _newVaultsCore) external; }
//
LineComment
upgrade
function upgrade(address _newVaultsCore) external;
//upgrade
LineComment
v0.6.12+commit.27d51765
MIT
{ "func_code_index": [ 1799, 1851 ] }
58,840
AddressProvider
AddressProvider.sol
0x6fae125de41c03fa7d917ccfa17ba54ef4feb014
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
MIT
{ "func_code_index": [ 90, 149 ] }
58,841
AddressProvider
AddressProvider.sol
0x6fae125de41c03fa7d917ccfa17ba54ef4feb014
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
MIT
{ "func_code_index": [ 228, 300 ] }
58,842
AddressProvider
AddressProvider.sol
0x6fae125de41c03fa7d917ccfa17ba54ef4feb014
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
MIT
{ "func_code_index": [ 516, 597 ] }
58,843
AddressProvider
AddressProvider.sol
0x6fae125de41c03fa7d917ccfa17ba54ef4feb014
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
MIT
{ "func_code_index": [ 868, 955 ] }
58,844
AddressProvider
AddressProvider.sol
0x6fae125de41c03fa7d917ccfa17ba54ef4feb014
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
MIT
{ "func_code_index": [ 1604, 1682 ] }
58,845
AddressProvider
AddressProvider.sol
0x6fae125de41c03fa7d917ccfa17ba54ef4feb014
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
MIT
{ "func_code_index": [ 1985, 2086 ] }
58,846
AddressProvider
AddressProvider.sol
0x6fae125de41c03fa7d917ccfa17ba54ef4feb014
Solidity
IRatesManager
interface IRatesManager { function a() external view returns (IAddressProvider); //current annualized borrow rate function annualizedBorrowRate(uint256 _currentBorrowRate) external pure returns (uint256); //uses current cumulative rate to calculate totalDebt based on baseDebt at time T0 function calculateDebt(uint256 _baseDebt, uint256 _cumulativeRate) external pure returns (uint256); //uses current cumulative rate to calculate baseDebt at time T0 function calculateBaseDebt(uint256 _debt, uint256 _cumulativeRate) external pure returns (uint256); //calculate a new cumulative rate function calculateCumulativeRate( uint256 _borrowRate, uint256 _cumulativeRate, uint256 _timeElapsed ) external view returns (uint256); }
//
LineComment
annualizedBorrowRate
function annualizedBorrowRate(uint256 _currentBorrowRate) external pure returns (uint256);
//current annualized borrow rate
LineComment
v0.6.12+commit.27d51765
MIT
{ "func_code_index": [ 119, 211 ] }
58,847
AddressProvider
AddressProvider.sol
0x6fae125de41c03fa7d917ccfa17ba54ef4feb014
Solidity
IRatesManager
interface IRatesManager { function a() external view returns (IAddressProvider); //current annualized borrow rate function annualizedBorrowRate(uint256 _currentBorrowRate) external pure returns (uint256); //uses current cumulative rate to calculate totalDebt based on baseDebt at time T0 function calculateDebt(uint256 _baseDebt, uint256 _cumulativeRate) external pure returns (uint256); //uses current cumulative rate to calculate baseDebt at time T0 function calculateBaseDebt(uint256 _debt, uint256 _cumulativeRate) external pure returns (uint256); //calculate a new cumulative rate function calculateCumulativeRate( uint256 _borrowRate, uint256 _cumulativeRate, uint256 _timeElapsed ) external view returns (uint256); }
//
LineComment
calculateDebt
function calculateDebt(uint256 _baseDebt, uint256 _cumulativeRate) external pure returns (uint256);
//uses current cumulative rate to calculate totalDebt based on baseDebt at time T0
LineComment
v0.6.12+commit.27d51765
MIT
{ "func_code_index": [ 298, 399 ] }
58,848
AddressProvider
AddressProvider.sol
0x6fae125de41c03fa7d917ccfa17ba54ef4feb014
Solidity
IRatesManager
interface IRatesManager { function a() external view returns (IAddressProvider); //current annualized borrow rate function annualizedBorrowRate(uint256 _currentBorrowRate) external pure returns (uint256); //uses current cumulative rate to calculate totalDebt based on baseDebt at time T0 function calculateDebt(uint256 _baseDebt, uint256 _cumulativeRate) external pure returns (uint256); //uses current cumulative rate to calculate baseDebt at time T0 function calculateBaseDebt(uint256 _debt, uint256 _cumulativeRate) external pure returns (uint256); //calculate a new cumulative rate function calculateCumulativeRate( uint256 _borrowRate, uint256 _cumulativeRate, uint256 _timeElapsed ) external view returns (uint256); }
//
LineComment
calculateBaseDebt
function calculateBaseDebt(uint256 _debt, uint256 _cumulativeRate) external pure returns (uint256);
//uses current cumulative rate to calculate baseDebt at time T0
LineComment
v0.6.12+commit.27d51765
MIT
{ "func_code_index": [ 467, 568 ] }
58,849
AddressProvider
AddressProvider.sol
0x6fae125de41c03fa7d917ccfa17ba54ef4feb014
Solidity
IRatesManager
interface IRatesManager { function a() external view returns (IAddressProvider); //current annualized borrow rate function annualizedBorrowRate(uint256 _currentBorrowRate) external pure returns (uint256); //uses current cumulative rate to calculate totalDebt based on baseDebt at time T0 function calculateDebt(uint256 _baseDebt, uint256 _cumulativeRate) external pure returns (uint256); //uses current cumulative rate to calculate baseDebt at time T0 function calculateBaseDebt(uint256 _debt, uint256 _cumulativeRate) external pure returns (uint256); //calculate a new cumulative rate function calculateCumulativeRate( uint256 _borrowRate, uint256 _cumulativeRate, uint256 _timeElapsed ) external view returns (uint256); }
//
LineComment
calculateCumulativeRate
function calculateCumulativeRate( uint256 _borrowRate, uint256 _cumulativeRate, uint256 _timeElapsed ) external view returns (uint256);
//calculate a new cumulative rate
LineComment
v0.6.12+commit.27d51765
MIT
{ "func_code_index": [ 606, 757 ] }
58,850
AddressProvider
AddressProvider.sol
0x6fae125de41c03fa7d917ccfa17ba54ef4feb014
Solidity
IVaultsDataProvider
interface IVaultsDataProvider { struct Vault { // borrowedType support USDX / PAR address collateralType; address owner; uint256 collateralBalance; uint256 baseDebt; uint256 createdAt; } function a() external view returns (IAddressProvider); // Read function baseDebt(address _collateralType) external view returns (uint256); function vaultCount() external view returns (uint256); function vaults(uint256 _id) external view returns (Vault memory); function vaultOwner(uint256 _id) external view returns (address); function vaultCollateralType(uint256 _id) external view returns (address); function vaultCollateralBalance(uint256 _id) external view returns (uint256); function vaultBaseDebt(uint256 _id) external view returns (uint256); function vaultId(address _collateralType, address _owner) external view returns (uint256); function vaultExists(uint256 _id) external view returns (bool); function vaultDebt(uint256 _vaultId) external view returns (uint256); function debt() external view returns (uint256); function collateralDebt(address _collateralType) external view returns (uint256); //Write function createVault(address _collateralType, address _owner) external returns (uint256); function setCollateralBalance(uint256 _id, uint256 _balance) external; function setBaseDebt(uint256 _id, uint256 _newBaseDebt) external; }
//
LineComment
baseDebt
function baseDebt(address _collateralType) external view returns (uint256);
// Read
LineComment
v0.6.12+commit.27d51765
MIT
{ "func_code_index": [ 284, 361 ] }
58,851
AddressProvider
AddressProvider.sol
0x6fae125de41c03fa7d917ccfa17ba54ef4feb014
Solidity
IVaultsDataProvider
interface IVaultsDataProvider { struct Vault { // borrowedType support USDX / PAR address collateralType; address owner; uint256 collateralBalance; uint256 baseDebt; uint256 createdAt; } function a() external view returns (IAddressProvider); // Read function baseDebt(address _collateralType) external view returns (uint256); function vaultCount() external view returns (uint256); function vaults(uint256 _id) external view returns (Vault memory); function vaultOwner(uint256 _id) external view returns (address); function vaultCollateralType(uint256 _id) external view returns (address); function vaultCollateralBalance(uint256 _id) external view returns (uint256); function vaultBaseDebt(uint256 _id) external view returns (uint256); function vaultId(address _collateralType, address _owner) external view returns (uint256); function vaultExists(uint256 _id) external view returns (bool); function vaultDebt(uint256 _vaultId) external view returns (uint256); function debt() external view returns (uint256); function collateralDebt(address _collateralType) external view returns (uint256); //Write function createVault(address _collateralType, address _owner) external returns (uint256); function setCollateralBalance(uint256 _id, uint256 _balance) external; function setBaseDebt(uint256 _id, uint256 _newBaseDebt) external; }
//
LineComment
createVault
function createVault(address _collateralType, address _owner) external returns (uint256);
//Write
LineComment
v0.6.12+commit.27d51765
MIT
{ "func_code_index": [ 1172, 1263 ] }
58,852
GasToken
GasToken.sol
0xde299038830f2bc6f20c8e9603586f4438e93ad6
Solidity
GasToken
contract GasToken is ERC20 { // Coin Defaults string public name = "Vether Gas Coin"; string public symbol = "VGC"; uint256 public decimals = 18; uint256 public override totalSupply = (2 ** 256) - 1; address public burnAddress; // Mapping mapping(address => uint256) public override balanceOf; mapping(address => mapping(address => uint256)) public override allowance; mapping(uint => string) public gasStorage; // Events event Approval(address indexed owner, address indexed spender, uint value); event Transfer(address indexed from, address indexed to, uint256 value); // Minting event constructor() public{ burnAddress = 0x0111011001100001011011000111010101100101; balanceOf[msg.sender] = totalSupply; emit Transfer(address(0), msg.sender, totalSupply); } // ERC20 function transfer(address to, uint256 value) public override returns (bool success) { _transfer(msg.sender, to, value); return true; } // ERC20 function approve(address spender, uint256 value) public override returns (bool success) { allowance[msg.sender][spender] = value; emit Approval(msg.sender, spender, value); return true; } // ERC20 function transferFrom(address from, address to, uint256 value) public override returns (bool success) { require(value <= allowance[from][msg.sender]); allowance[from][msg.sender] -= value; _transfer(from, to, value); return true; } // Transfer function which includes the gas storage function _transfer(address _from, address _to, uint _value) internal { require(balanceOf[_from] >= _value); require(balanceOf[_to] + _value >= balanceOf[_to]); balanceOf[_from] = balanceOf[_from] - _value; balanceOf[_to] = balanceOf[_to] + _value; if (_to == burnAddress) { for(uint i = 0; i < 100; i++){ gasStorage[i]="GASSTORAGEGASSTORAGEGASTORAGEGASSTORAGEGASSTORAGEGASTORAGEGASSTORAGEGASSTORAGEGASTORAGE"; // 8.7kb total } } emit Transfer(_from, _to, _value); } function resetGas() public { for(uint i = 0; i < 100; i++){ gasStorage[i]="0"; } } }
// Token Contract
LineComment
transfer
function transfer(address to, uint256 value) public override returns (bool success) { _transfer(msg.sender, to, value); return true; }
// ERC20
LineComment
v0.6.4+commit.1dca32f3
None
ipfs://1eb08e950396fa69ad945e78ff711fc515475f961c1983f13c5e85293882f828
{ "func_code_index": [ 899, 1061 ] }
58,853
GasToken
GasToken.sol
0xde299038830f2bc6f20c8e9603586f4438e93ad6
Solidity
GasToken
contract GasToken is ERC20 { // Coin Defaults string public name = "Vether Gas Coin"; string public symbol = "VGC"; uint256 public decimals = 18; uint256 public override totalSupply = (2 ** 256) - 1; address public burnAddress; // Mapping mapping(address => uint256) public override balanceOf; mapping(address => mapping(address => uint256)) public override allowance; mapping(uint => string) public gasStorage; // Events event Approval(address indexed owner, address indexed spender, uint value); event Transfer(address indexed from, address indexed to, uint256 value); // Minting event constructor() public{ burnAddress = 0x0111011001100001011011000111010101100101; balanceOf[msg.sender] = totalSupply; emit Transfer(address(0), msg.sender, totalSupply); } // ERC20 function transfer(address to, uint256 value) public override returns (bool success) { _transfer(msg.sender, to, value); return true; } // ERC20 function approve(address spender, uint256 value) public override returns (bool success) { allowance[msg.sender][spender] = value; emit Approval(msg.sender, spender, value); return true; } // ERC20 function transferFrom(address from, address to, uint256 value) public override returns (bool success) { require(value <= allowance[from][msg.sender]); allowance[from][msg.sender] -= value; _transfer(from, to, value); return true; } // Transfer function which includes the gas storage function _transfer(address _from, address _to, uint _value) internal { require(balanceOf[_from] >= _value); require(balanceOf[_to] + _value >= balanceOf[_to]); balanceOf[_from] = balanceOf[_from] - _value; balanceOf[_to] = balanceOf[_to] + _value; if (_to == burnAddress) { for(uint i = 0; i < 100; i++){ gasStorage[i]="GASSTORAGEGASSTORAGEGASTORAGEGASSTORAGEGASSTORAGEGASTORAGEGASSTORAGEGASSTORAGEGASTORAGE"; // 8.7kb total } } emit Transfer(_from, _to, _value); } function resetGas() public { for(uint i = 0; i < 100; i++){ gasStorage[i]="0"; } } }
// Token Contract
LineComment
approve
function approve(address spender, uint256 value) public override returns (bool success) { allowance[msg.sender][spender] = value; emit Approval(msg.sender, spender, value); return true; }
// ERC20
LineComment
v0.6.4+commit.1dca32f3
None
ipfs://1eb08e950396fa69ad945e78ff711fc515475f961c1983f13c5e85293882f828
{ "func_code_index": [ 1078, 1302 ] }
58,854
GasToken
GasToken.sol
0xde299038830f2bc6f20c8e9603586f4438e93ad6
Solidity
GasToken
contract GasToken is ERC20 { // Coin Defaults string public name = "Vether Gas Coin"; string public symbol = "VGC"; uint256 public decimals = 18; uint256 public override totalSupply = (2 ** 256) - 1; address public burnAddress; // Mapping mapping(address => uint256) public override balanceOf; mapping(address => mapping(address => uint256)) public override allowance; mapping(uint => string) public gasStorage; // Events event Approval(address indexed owner, address indexed spender, uint value); event Transfer(address indexed from, address indexed to, uint256 value); // Minting event constructor() public{ burnAddress = 0x0111011001100001011011000111010101100101; balanceOf[msg.sender] = totalSupply; emit Transfer(address(0), msg.sender, totalSupply); } // ERC20 function transfer(address to, uint256 value) public override returns (bool success) { _transfer(msg.sender, to, value); return true; } // ERC20 function approve(address spender, uint256 value) public override returns (bool success) { allowance[msg.sender][spender] = value; emit Approval(msg.sender, spender, value); return true; } // ERC20 function transferFrom(address from, address to, uint256 value) public override returns (bool success) { require(value <= allowance[from][msg.sender]); allowance[from][msg.sender] -= value; _transfer(from, to, value); return true; } // Transfer function which includes the gas storage function _transfer(address _from, address _to, uint _value) internal { require(balanceOf[_from] >= _value); require(balanceOf[_to] + _value >= balanceOf[_to]); balanceOf[_from] = balanceOf[_from] - _value; balanceOf[_to] = balanceOf[_to] + _value; if (_to == burnAddress) { for(uint i = 0; i < 100; i++){ gasStorage[i]="GASSTORAGEGASSTORAGEGASTORAGEGASSTORAGEGASSTORAGEGASTORAGEGASSTORAGEGASSTORAGEGASTORAGE"; // 8.7kb total } } emit Transfer(_from, _to, _value); } function resetGas() public { for(uint i = 0; i < 100; i++){ gasStorage[i]="0"; } } }
// Token Contract
LineComment
transferFrom
function transferFrom(address from, address to, uint256 value) public override returns (bool success) { require(value <= allowance[from][msg.sender]); allowance[from][msg.sender] -= value; _transfer(from, to, value); return true; }
// ERC20
LineComment
v0.6.4+commit.1dca32f3
None
ipfs://1eb08e950396fa69ad945e78ff711fc515475f961c1983f13c5e85293882f828
{ "func_code_index": [ 1319, 1596 ] }
58,855
GasToken
GasToken.sol
0xde299038830f2bc6f20c8e9603586f4438e93ad6
Solidity
GasToken
contract GasToken is ERC20 { // Coin Defaults string public name = "Vether Gas Coin"; string public symbol = "VGC"; uint256 public decimals = 18; uint256 public override totalSupply = (2 ** 256) - 1; address public burnAddress; // Mapping mapping(address => uint256) public override balanceOf; mapping(address => mapping(address => uint256)) public override allowance; mapping(uint => string) public gasStorage; // Events event Approval(address indexed owner, address indexed spender, uint value); event Transfer(address indexed from, address indexed to, uint256 value); // Minting event constructor() public{ burnAddress = 0x0111011001100001011011000111010101100101; balanceOf[msg.sender] = totalSupply; emit Transfer(address(0), msg.sender, totalSupply); } // ERC20 function transfer(address to, uint256 value) public override returns (bool success) { _transfer(msg.sender, to, value); return true; } // ERC20 function approve(address spender, uint256 value) public override returns (bool success) { allowance[msg.sender][spender] = value; emit Approval(msg.sender, spender, value); return true; } // ERC20 function transferFrom(address from, address to, uint256 value) public override returns (bool success) { require(value <= allowance[from][msg.sender]); allowance[from][msg.sender] -= value; _transfer(from, to, value); return true; } // Transfer function which includes the gas storage function _transfer(address _from, address _to, uint _value) internal { require(balanceOf[_from] >= _value); require(balanceOf[_to] + _value >= balanceOf[_to]); balanceOf[_from] = balanceOf[_from] - _value; balanceOf[_to] = balanceOf[_to] + _value; if (_to == burnAddress) { for(uint i = 0; i < 100; i++){ gasStorage[i]="GASSTORAGEGASSTORAGEGASTORAGEGASSTORAGEGASSTORAGEGASTORAGEGASSTORAGEGASSTORAGEGASTORAGE"; // 8.7kb total } } emit Transfer(_from, _to, _value); } function resetGas() public { for(uint i = 0; i < 100; i++){ gasStorage[i]="0"; } } }
// Token Contract
LineComment
_transfer
function _transfer(address _from, address _to, uint _value) internal { require(balanceOf[_from] >= _value); require(balanceOf[_to] + _value >= balanceOf[_to]); balanceOf[_from] = balanceOf[_from] - _value; balanceOf[_to] = balanceOf[_to] + _value; if (_to == burnAddress) { for(uint i = 0; i < 100; i++){ gasStorage[i]="GASSTORAGEGASSTORAGEGASTORAGEGASSTORAGEGASSTORAGEGASTORAGEGASSTORAGEGASSTORAGEGASTORAGE"; // 8.7kb total } } emit Transfer(_from, _to, _value); }
// Transfer function which includes the gas storage
LineComment
v0.6.4+commit.1dca32f3
None
ipfs://1eb08e950396fa69ad945e78ff711fc515475f961c1983f13c5e85293882f828
{ "func_code_index": [ 1656, 2277 ] }
58,856
LiquidityMiningFactory
contracts\liquidity-mining\LiquidityMiningFactory.sol
0x9df4e915d093f03169270857cf9a0a5d1ef26388
Solidity
LiquidityMiningFactory
contract LiquidityMiningFactory is ILiquidityMiningFactory { // liquidity mining contract implementation address address public liquidityMiningImplementationAddress; // liquidity mining default extension address public override liquidityMiningDefaultExtension; // double proxy address of the linked DFO address public _doubleProxy; // linked DFO exit fee uint256 private _feePercentage; // liquidity mining collection uri string public liquidityFarmTokenCollectionURI; // liquidity mining farm token uri string public liquidityFarmTokenURI; // event that tracks liquidity mining contracts deployed event LiquidityMiningDeployed(address indexed liquidityMiningAddress, address indexed sender, bytes liquidityMiningInitResultData); // event that tracks logic contract address change event LiquidityMiningLogicSet(address indexed newAddress); // event that tracks default extension contract address change event LiquidityMiningDefaultExtensionSet(address indexed newAddress); // event that tracks wallet changes event FeePercentageSet(uint256 newFeePercentage); constructor(address doubleProxy, address _liquidityMiningImplementationAddress, address _liquidityMiningDefaultExtension, uint256 feePercentage, string memory liquidityFarmTokenCollectionUri, string memory liquidityFarmTokenUri) { _doubleProxy = doubleProxy; liquidityFarmTokenCollectionURI = liquidityFarmTokenCollectionUri; liquidityFarmTokenURI = liquidityFarmTokenUri; emit LiquidityMiningLogicSet(liquidityMiningImplementationAddress = _liquidityMiningImplementationAddress); emit LiquidityMiningDefaultExtensionSet(liquidityMiningDefaultExtension = _liquidityMiningDefaultExtension); emit FeePercentageSet(_feePercentage = feePercentage); } /** PUBLIC METHODS */ function feePercentageInfo() public override view returns (uint256, address) { return (_feePercentage, IMVDProxy(IDoubleProxy(_doubleProxy).proxy()).getMVDWalletAddress()); } /** @dev allows the DFO to update the double proxy address. * @param newDoubleProxy new double proxy address. */ function setDoubleProxy(address newDoubleProxy) public onlyDFO { _doubleProxy = newDoubleProxy; } /** @dev change the fee percentage * @param feePercentage new fee percentage. */ function updateFeePercentage(uint256 feePercentage) public onlyDFO { emit FeePercentageSet(_feePercentage = feePercentage); } /** @dev allows the factory owner to update the logic contract address. * @param _liquidityMiningImplementationAddress new liquidity mining implementation address. */ function updateLogicAddress(address _liquidityMiningImplementationAddress) public onlyDFO { emit LiquidityMiningLogicSet(liquidityMiningImplementationAddress = _liquidityMiningImplementationAddress); } /** @dev allows the factory owner to update the default extension contract address. * @param _liquidityMiningDefaultExtensionAddress new liquidity mining extension address. */ function updateDefaultExtensionAddress(address _liquidityMiningDefaultExtensionAddress) public onlyDFO { emit LiquidityMiningDefaultExtensionSet(liquidityMiningDefaultExtension = _liquidityMiningDefaultExtensionAddress); } /** @dev allows the factory owner to update the liquidity farm token collection uri. * @param liquidityFarmTokenCollectionUri new liquidity farm token collection uri. */ function updateLiquidityFarmTokenCollectionURI(string memory liquidityFarmTokenCollectionUri) public onlyDFO { liquidityFarmTokenCollectionURI = liquidityFarmTokenCollectionUri; } /** @dev allows the factory owner to update the liquidity farm token collection uri. * @param liquidityFarmTokenUri new liquidity farm token collection uri. */ function updateLiquidityFarmTokenURI(string memory liquidityFarmTokenUri) public onlyDFO { liquidityFarmTokenURI = liquidityFarmTokenUri; } /** @dev returns the liquidity farm token collection uri. * @return liquidity farm token collection uri. */ function getLiquidityFarmTokenCollectionURI() public override view returns (string memory) { return liquidityFarmTokenCollectionURI; } /** @dev returns the liquidity farm token uri. * @return liquidity farm token uri. */ function getLiquidityFarmTokenURI() public override view returns (string memory) { return liquidityFarmTokenURI; } /** @dev utlity method to clone default extension * @return clonedExtension the address of the actually-cloned liquidity mining extension */ function cloneLiquidityMiningDefaultExtension() public override returns(address clonedExtension) { emit ExtensionCloned(clonedExtension = _clone(liquidityMiningDefaultExtension)); } /** @dev this function deploys a new LiquidityMining contract and calls the encoded function passed as data. * @param data encoded initialize function for the liquidity mining contract (check LiquidityMining contract code). * @return contractAddress new liquidity mining contract address. * @return initResultData new liquidity mining contract call result. */ function deploy(bytes memory data) public returns (address contractAddress, bytes memory initResultData) { initResultData = _call(contractAddress = _clone(liquidityMiningImplementationAddress), data); emit LiquidityMiningDeployed(contractAddress, msg.sender, initResultData); } /** PRIVATE METHODS */ /** @dev clones the input contract address and returns the copied contract address. * @param original address of the original contract. * @return copy copied contract address. */ function _clone(address original) private returns (address copy) { assembly { mstore( 0, or( 0x5880730000000000000000000000000000000000000000803b80938091923cF3, mul(original, 0x1000000000000000000) ) ) copy := create(0, 0, 32) switch extcodesize(copy) case 0 { invalid() } } } /** @dev calls the contract at the given location using the given payload and returns the returnData. * @param location location to call. * @param payload call payload. * @return returnData call return data. */ function _call(address location, bytes memory payload) private returns(bytes memory returnData) { assembly { let result := call(gas(), location, 0, add(payload, 0x20), mload(payload), 0, 0) let size := returndatasize() returnData := mload(0x40) mstore(returnData, size) let returnDataPayloadStart := add(returnData, 0x20) returndatacopy(returnDataPayloadStart, 0, size) mstore(0x40, add(returnDataPayloadStart, size)) switch result case 0 {revert(returnDataPayloadStart, size)} } } /** @dev onlyDFO modifier used to check for unauthorized accesses. */ modifier onlyDFO() { require(IMVDFunctionalitiesManager(IMVDProxy(IDoubleProxy(_doubleProxy).proxy()).getMVDFunctionalitiesManagerAddress()).isAuthorizedFunctionality(msg.sender), "Unauthorized."); _; } }
feePercentageInfo
function feePercentageInfo() public override view returns (uint256, address) { return (_feePercentage, IMVDProxy(IDoubleProxy(_doubleProxy).proxy()).getMVDWalletAddress()); }
/** PUBLIC METHODS */
NatSpecMultiLine
v0.7.6+commit.7338295f
MIT
ipfs://f058c01d1a28d1984b20f4a56b451c5333cbb324fde2ceba602ca7e5b331c64a
{ "func_code_index": [ 1906, 2099 ] }
58,857
LiquidityMiningFactory
contracts\liquidity-mining\LiquidityMiningFactory.sol
0x9df4e915d093f03169270857cf9a0a5d1ef26388
Solidity
LiquidityMiningFactory
contract LiquidityMiningFactory is ILiquidityMiningFactory { // liquidity mining contract implementation address address public liquidityMiningImplementationAddress; // liquidity mining default extension address public override liquidityMiningDefaultExtension; // double proxy address of the linked DFO address public _doubleProxy; // linked DFO exit fee uint256 private _feePercentage; // liquidity mining collection uri string public liquidityFarmTokenCollectionURI; // liquidity mining farm token uri string public liquidityFarmTokenURI; // event that tracks liquidity mining contracts deployed event LiquidityMiningDeployed(address indexed liquidityMiningAddress, address indexed sender, bytes liquidityMiningInitResultData); // event that tracks logic contract address change event LiquidityMiningLogicSet(address indexed newAddress); // event that tracks default extension contract address change event LiquidityMiningDefaultExtensionSet(address indexed newAddress); // event that tracks wallet changes event FeePercentageSet(uint256 newFeePercentage); constructor(address doubleProxy, address _liquidityMiningImplementationAddress, address _liquidityMiningDefaultExtension, uint256 feePercentage, string memory liquidityFarmTokenCollectionUri, string memory liquidityFarmTokenUri) { _doubleProxy = doubleProxy; liquidityFarmTokenCollectionURI = liquidityFarmTokenCollectionUri; liquidityFarmTokenURI = liquidityFarmTokenUri; emit LiquidityMiningLogicSet(liquidityMiningImplementationAddress = _liquidityMiningImplementationAddress); emit LiquidityMiningDefaultExtensionSet(liquidityMiningDefaultExtension = _liquidityMiningDefaultExtension); emit FeePercentageSet(_feePercentage = feePercentage); } /** PUBLIC METHODS */ function feePercentageInfo() public override view returns (uint256, address) { return (_feePercentage, IMVDProxy(IDoubleProxy(_doubleProxy).proxy()).getMVDWalletAddress()); } /** @dev allows the DFO to update the double proxy address. * @param newDoubleProxy new double proxy address. */ function setDoubleProxy(address newDoubleProxy) public onlyDFO { _doubleProxy = newDoubleProxy; } /** @dev change the fee percentage * @param feePercentage new fee percentage. */ function updateFeePercentage(uint256 feePercentage) public onlyDFO { emit FeePercentageSet(_feePercentage = feePercentage); } /** @dev allows the factory owner to update the logic contract address. * @param _liquidityMiningImplementationAddress new liquidity mining implementation address. */ function updateLogicAddress(address _liquidityMiningImplementationAddress) public onlyDFO { emit LiquidityMiningLogicSet(liquidityMiningImplementationAddress = _liquidityMiningImplementationAddress); } /** @dev allows the factory owner to update the default extension contract address. * @param _liquidityMiningDefaultExtensionAddress new liquidity mining extension address. */ function updateDefaultExtensionAddress(address _liquidityMiningDefaultExtensionAddress) public onlyDFO { emit LiquidityMiningDefaultExtensionSet(liquidityMiningDefaultExtension = _liquidityMiningDefaultExtensionAddress); } /** @dev allows the factory owner to update the liquidity farm token collection uri. * @param liquidityFarmTokenCollectionUri new liquidity farm token collection uri. */ function updateLiquidityFarmTokenCollectionURI(string memory liquidityFarmTokenCollectionUri) public onlyDFO { liquidityFarmTokenCollectionURI = liquidityFarmTokenCollectionUri; } /** @dev allows the factory owner to update the liquidity farm token collection uri. * @param liquidityFarmTokenUri new liquidity farm token collection uri. */ function updateLiquidityFarmTokenURI(string memory liquidityFarmTokenUri) public onlyDFO { liquidityFarmTokenURI = liquidityFarmTokenUri; } /** @dev returns the liquidity farm token collection uri. * @return liquidity farm token collection uri. */ function getLiquidityFarmTokenCollectionURI() public override view returns (string memory) { return liquidityFarmTokenCollectionURI; } /** @dev returns the liquidity farm token uri. * @return liquidity farm token uri. */ function getLiquidityFarmTokenURI() public override view returns (string memory) { return liquidityFarmTokenURI; } /** @dev utlity method to clone default extension * @return clonedExtension the address of the actually-cloned liquidity mining extension */ function cloneLiquidityMiningDefaultExtension() public override returns(address clonedExtension) { emit ExtensionCloned(clonedExtension = _clone(liquidityMiningDefaultExtension)); } /** @dev this function deploys a new LiquidityMining contract and calls the encoded function passed as data. * @param data encoded initialize function for the liquidity mining contract (check LiquidityMining contract code). * @return contractAddress new liquidity mining contract address. * @return initResultData new liquidity mining contract call result. */ function deploy(bytes memory data) public returns (address contractAddress, bytes memory initResultData) { initResultData = _call(contractAddress = _clone(liquidityMiningImplementationAddress), data); emit LiquidityMiningDeployed(contractAddress, msg.sender, initResultData); } /** PRIVATE METHODS */ /** @dev clones the input contract address and returns the copied contract address. * @param original address of the original contract. * @return copy copied contract address. */ function _clone(address original) private returns (address copy) { assembly { mstore( 0, or( 0x5880730000000000000000000000000000000000000000803b80938091923cF3, mul(original, 0x1000000000000000000) ) ) copy := create(0, 0, 32) switch extcodesize(copy) case 0 { invalid() } } } /** @dev calls the contract at the given location using the given payload and returns the returnData. * @param location location to call. * @param payload call payload. * @return returnData call return data. */ function _call(address location, bytes memory payload) private returns(bytes memory returnData) { assembly { let result := call(gas(), location, 0, add(payload, 0x20), mload(payload), 0, 0) let size := returndatasize() returnData := mload(0x40) mstore(returnData, size) let returnDataPayloadStart := add(returnData, 0x20) returndatacopy(returnDataPayloadStart, 0, size) mstore(0x40, add(returnDataPayloadStart, size)) switch result case 0 {revert(returnDataPayloadStart, size)} } } /** @dev onlyDFO modifier used to check for unauthorized accesses. */ modifier onlyDFO() { require(IMVDFunctionalitiesManager(IMVDProxy(IDoubleProxy(_doubleProxy).proxy()).getMVDFunctionalitiesManagerAddress()).isAuthorizedFunctionality(msg.sender), "Unauthorized."); _; } }
setDoubleProxy
function setDoubleProxy(address newDoubleProxy) public onlyDFO { _doubleProxy = newDoubleProxy; }
/** @dev allows the DFO to update the double proxy address. * @param newDoubleProxy new double proxy address. */
NatSpecMultiLine
v0.7.6+commit.7338295f
MIT
ipfs://f058c01d1a28d1984b20f4a56b451c5333cbb324fde2ceba602ca7e5b331c64a
{ "func_code_index": [ 2232, 2348 ] }
58,858
LiquidityMiningFactory
contracts\liquidity-mining\LiquidityMiningFactory.sol
0x9df4e915d093f03169270857cf9a0a5d1ef26388
Solidity
LiquidityMiningFactory
contract LiquidityMiningFactory is ILiquidityMiningFactory { // liquidity mining contract implementation address address public liquidityMiningImplementationAddress; // liquidity mining default extension address public override liquidityMiningDefaultExtension; // double proxy address of the linked DFO address public _doubleProxy; // linked DFO exit fee uint256 private _feePercentage; // liquidity mining collection uri string public liquidityFarmTokenCollectionURI; // liquidity mining farm token uri string public liquidityFarmTokenURI; // event that tracks liquidity mining contracts deployed event LiquidityMiningDeployed(address indexed liquidityMiningAddress, address indexed sender, bytes liquidityMiningInitResultData); // event that tracks logic contract address change event LiquidityMiningLogicSet(address indexed newAddress); // event that tracks default extension contract address change event LiquidityMiningDefaultExtensionSet(address indexed newAddress); // event that tracks wallet changes event FeePercentageSet(uint256 newFeePercentage); constructor(address doubleProxy, address _liquidityMiningImplementationAddress, address _liquidityMiningDefaultExtension, uint256 feePercentage, string memory liquidityFarmTokenCollectionUri, string memory liquidityFarmTokenUri) { _doubleProxy = doubleProxy; liquidityFarmTokenCollectionURI = liquidityFarmTokenCollectionUri; liquidityFarmTokenURI = liquidityFarmTokenUri; emit LiquidityMiningLogicSet(liquidityMiningImplementationAddress = _liquidityMiningImplementationAddress); emit LiquidityMiningDefaultExtensionSet(liquidityMiningDefaultExtension = _liquidityMiningDefaultExtension); emit FeePercentageSet(_feePercentage = feePercentage); } /** PUBLIC METHODS */ function feePercentageInfo() public override view returns (uint256, address) { return (_feePercentage, IMVDProxy(IDoubleProxy(_doubleProxy).proxy()).getMVDWalletAddress()); } /** @dev allows the DFO to update the double proxy address. * @param newDoubleProxy new double proxy address. */ function setDoubleProxy(address newDoubleProxy) public onlyDFO { _doubleProxy = newDoubleProxy; } /** @dev change the fee percentage * @param feePercentage new fee percentage. */ function updateFeePercentage(uint256 feePercentage) public onlyDFO { emit FeePercentageSet(_feePercentage = feePercentage); } /** @dev allows the factory owner to update the logic contract address. * @param _liquidityMiningImplementationAddress new liquidity mining implementation address. */ function updateLogicAddress(address _liquidityMiningImplementationAddress) public onlyDFO { emit LiquidityMiningLogicSet(liquidityMiningImplementationAddress = _liquidityMiningImplementationAddress); } /** @dev allows the factory owner to update the default extension contract address. * @param _liquidityMiningDefaultExtensionAddress new liquidity mining extension address. */ function updateDefaultExtensionAddress(address _liquidityMiningDefaultExtensionAddress) public onlyDFO { emit LiquidityMiningDefaultExtensionSet(liquidityMiningDefaultExtension = _liquidityMiningDefaultExtensionAddress); } /** @dev allows the factory owner to update the liquidity farm token collection uri. * @param liquidityFarmTokenCollectionUri new liquidity farm token collection uri. */ function updateLiquidityFarmTokenCollectionURI(string memory liquidityFarmTokenCollectionUri) public onlyDFO { liquidityFarmTokenCollectionURI = liquidityFarmTokenCollectionUri; } /** @dev allows the factory owner to update the liquidity farm token collection uri. * @param liquidityFarmTokenUri new liquidity farm token collection uri. */ function updateLiquidityFarmTokenURI(string memory liquidityFarmTokenUri) public onlyDFO { liquidityFarmTokenURI = liquidityFarmTokenUri; } /** @dev returns the liquidity farm token collection uri. * @return liquidity farm token collection uri. */ function getLiquidityFarmTokenCollectionURI() public override view returns (string memory) { return liquidityFarmTokenCollectionURI; } /** @dev returns the liquidity farm token uri. * @return liquidity farm token uri. */ function getLiquidityFarmTokenURI() public override view returns (string memory) { return liquidityFarmTokenURI; } /** @dev utlity method to clone default extension * @return clonedExtension the address of the actually-cloned liquidity mining extension */ function cloneLiquidityMiningDefaultExtension() public override returns(address clonedExtension) { emit ExtensionCloned(clonedExtension = _clone(liquidityMiningDefaultExtension)); } /** @dev this function deploys a new LiquidityMining contract and calls the encoded function passed as data. * @param data encoded initialize function for the liquidity mining contract (check LiquidityMining contract code). * @return contractAddress new liquidity mining contract address. * @return initResultData new liquidity mining contract call result. */ function deploy(bytes memory data) public returns (address contractAddress, bytes memory initResultData) { initResultData = _call(contractAddress = _clone(liquidityMiningImplementationAddress), data); emit LiquidityMiningDeployed(contractAddress, msg.sender, initResultData); } /** PRIVATE METHODS */ /** @dev clones the input contract address and returns the copied contract address. * @param original address of the original contract. * @return copy copied contract address. */ function _clone(address original) private returns (address copy) { assembly { mstore( 0, or( 0x5880730000000000000000000000000000000000000000803b80938091923cF3, mul(original, 0x1000000000000000000) ) ) copy := create(0, 0, 32) switch extcodesize(copy) case 0 { invalid() } } } /** @dev calls the contract at the given location using the given payload and returns the returnData. * @param location location to call. * @param payload call payload. * @return returnData call return data. */ function _call(address location, bytes memory payload) private returns(bytes memory returnData) { assembly { let result := call(gas(), location, 0, add(payload, 0x20), mload(payload), 0, 0) let size := returndatasize() returnData := mload(0x40) mstore(returnData, size) let returnDataPayloadStart := add(returnData, 0x20) returndatacopy(returnDataPayloadStart, 0, size) mstore(0x40, add(returnDataPayloadStart, size)) switch result case 0 {revert(returnDataPayloadStart, size)} } } /** @dev onlyDFO modifier used to check for unauthorized accesses. */ modifier onlyDFO() { require(IMVDFunctionalitiesManager(IMVDProxy(IDoubleProxy(_doubleProxy).proxy()).getMVDFunctionalitiesManagerAddress()).isAuthorizedFunctionality(msg.sender), "Unauthorized."); _; } }
updateFeePercentage
function updateFeePercentage(uint256 feePercentage) public onlyDFO { emit FeePercentageSet(_feePercentage = feePercentage); }
/** @dev change the fee percentage * @param feePercentage new fee percentage. */
NatSpecMultiLine
v0.7.6+commit.7338295f
MIT
ipfs://f058c01d1a28d1984b20f4a56b451c5333cbb324fde2ceba602ca7e5b331c64a
{ "func_code_index": [ 2449, 2593 ] }
58,859
LiquidityMiningFactory
contracts\liquidity-mining\LiquidityMiningFactory.sol
0x9df4e915d093f03169270857cf9a0a5d1ef26388
Solidity
LiquidityMiningFactory
contract LiquidityMiningFactory is ILiquidityMiningFactory { // liquidity mining contract implementation address address public liquidityMiningImplementationAddress; // liquidity mining default extension address public override liquidityMiningDefaultExtension; // double proxy address of the linked DFO address public _doubleProxy; // linked DFO exit fee uint256 private _feePercentage; // liquidity mining collection uri string public liquidityFarmTokenCollectionURI; // liquidity mining farm token uri string public liquidityFarmTokenURI; // event that tracks liquidity mining contracts deployed event LiquidityMiningDeployed(address indexed liquidityMiningAddress, address indexed sender, bytes liquidityMiningInitResultData); // event that tracks logic contract address change event LiquidityMiningLogicSet(address indexed newAddress); // event that tracks default extension contract address change event LiquidityMiningDefaultExtensionSet(address indexed newAddress); // event that tracks wallet changes event FeePercentageSet(uint256 newFeePercentage); constructor(address doubleProxy, address _liquidityMiningImplementationAddress, address _liquidityMiningDefaultExtension, uint256 feePercentage, string memory liquidityFarmTokenCollectionUri, string memory liquidityFarmTokenUri) { _doubleProxy = doubleProxy; liquidityFarmTokenCollectionURI = liquidityFarmTokenCollectionUri; liquidityFarmTokenURI = liquidityFarmTokenUri; emit LiquidityMiningLogicSet(liquidityMiningImplementationAddress = _liquidityMiningImplementationAddress); emit LiquidityMiningDefaultExtensionSet(liquidityMiningDefaultExtension = _liquidityMiningDefaultExtension); emit FeePercentageSet(_feePercentage = feePercentage); } /** PUBLIC METHODS */ function feePercentageInfo() public override view returns (uint256, address) { return (_feePercentage, IMVDProxy(IDoubleProxy(_doubleProxy).proxy()).getMVDWalletAddress()); } /** @dev allows the DFO to update the double proxy address. * @param newDoubleProxy new double proxy address. */ function setDoubleProxy(address newDoubleProxy) public onlyDFO { _doubleProxy = newDoubleProxy; } /** @dev change the fee percentage * @param feePercentage new fee percentage. */ function updateFeePercentage(uint256 feePercentage) public onlyDFO { emit FeePercentageSet(_feePercentage = feePercentage); } /** @dev allows the factory owner to update the logic contract address. * @param _liquidityMiningImplementationAddress new liquidity mining implementation address. */ function updateLogicAddress(address _liquidityMiningImplementationAddress) public onlyDFO { emit LiquidityMiningLogicSet(liquidityMiningImplementationAddress = _liquidityMiningImplementationAddress); } /** @dev allows the factory owner to update the default extension contract address. * @param _liquidityMiningDefaultExtensionAddress new liquidity mining extension address. */ function updateDefaultExtensionAddress(address _liquidityMiningDefaultExtensionAddress) public onlyDFO { emit LiquidityMiningDefaultExtensionSet(liquidityMiningDefaultExtension = _liquidityMiningDefaultExtensionAddress); } /** @dev allows the factory owner to update the liquidity farm token collection uri. * @param liquidityFarmTokenCollectionUri new liquidity farm token collection uri. */ function updateLiquidityFarmTokenCollectionURI(string memory liquidityFarmTokenCollectionUri) public onlyDFO { liquidityFarmTokenCollectionURI = liquidityFarmTokenCollectionUri; } /** @dev allows the factory owner to update the liquidity farm token collection uri. * @param liquidityFarmTokenUri new liquidity farm token collection uri. */ function updateLiquidityFarmTokenURI(string memory liquidityFarmTokenUri) public onlyDFO { liquidityFarmTokenURI = liquidityFarmTokenUri; } /** @dev returns the liquidity farm token collection uri. * @return liquidity farm token collection uri. */ function getLiquidityFarmTokenCollectionURI() public override view returns (string memory) { return liquidityFarmTokenCollectionURI; } /** @dev returns the liquidity farm token uri. * @return liquidity farm token uri. */ function getLiquidityFarmTokenURI() public override view returns (string memory) { return liquidityFarmTokenURI; } /** @dev utlity method to clone default extension * @return clonedExtension the address of the actually-cloned liquidity mining extension */ function cloneLiquidityMiningDefaultExtension() public override returns(address clonedExtension) { emit ExtensionCloned(clonedExtension = _clone(liquidityMiningDefaultExtension)); } /** @dev this function deploys a new LiquidityMining contract and calls the encoded function passed as data. * @param data encoded initialize function for the liquidity mining contract (check LiquidityMining contract code). * @return contractAddress new liquidity mining contract address. * @return initResultData new liquidity mining contract call result. */ function deploy(bytes memory data) public returns (address contractAddress, bytes memory initResultData) { initResultData = _call(contractAddress = _clone(liquidityMiningImplementationAddress), data); emit LiquidityMiningDeployed(contractAddress, msg.sender, initResultData); } /** PRIVATE METHODS */ /** @dev clones the input contract address and returns the copied contract address. * @param original address of the original contract. * @return copy copied contract address. */ function _clone(address original) private returns (address copy) { assembly { mstore( 0, or( 0x5880730000000000000000000000000000000000000000803b80938091923cF3, mul(original, 0x1000000000000000000) ) ) copy := create(0, 0, 32) switch extcodesize(copy) case 0 { invalid() } } } /** @dev calls the contract at the given location using the given payload and returns the returnData. * @param location location to call. * @param payload call payload. * @return returnData call return data. */ function _call(address location, bytes memory payload) private returns(bytes memory returnData) { assembly { let result := call(gas(), location, 0, add(payload, 0x20), mload(payload), 0, 0) let size := returndatasize() returnData := mload(0x40) mstore(returnData, size) let returnDataPayloadStart := add(returnData, 0x20) returndatacopy(returnDataPayloadStart, 0, size) mstore(0x40, add(returnDataPayloadStart, size)) switch result case 0 {revert(returnDataPayloadStart, size)} } } /** @dev onlyDFO modifier used to check for unauthorized accesses. */ modifier onlyDFO() { require(IMVDFunctionalitiesManager(IMVDProxy(IDoubleProxy(_doubleProxy).proxy()).getMVDFunctionalitiesManagerAddress()).isAuthorizedFunctionality(msg.sender), "Unauthorized."); _; } }
updateLogicAddress
function updateLogicAddress(address _liquidityMiningImplementationAddress) public onlyDFO { emit LiquidityMiningLogicSet(liquidityMiningImplementationAddress = _liquidityMiningImplementationAddress); }
/** @dev allows the factory owner to update the logic contract address. * @param _liquidityMiningImplementationAddress new liquidity mining implementation address. */
NatSpecMultiLine
v0.7.6+commit.7338295f
MIT
ipfs://f058c01d1a28d1984b20f4a56b451c5333cbb324fde2ceba602ca7e5b331c64a
{ "func_code_index": [ 2780, 3000 ] }
58,860