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
FUNGI
openzeppelin-solidity\contracts\access\Ownable.sol
0xe918925a67b49897d0780b22b738610068a18bb4
Solidity
Ownable
abstract 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 virtual returns (address) { return _owner; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(owner() == _msgSender(), "Ownable: caller is not the owner"); _; } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { emit OwnershipTransferred(_owner, address(0)); _owner = address(0); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { require( newOwner != address(0), "Ownable: new owner is the zero address" ); emit OwnershipTransferred(_owner, newOwner); _owner = newOwner; } }
/** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * By default, the owner account will be the one that deploys the contract. This * can later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */
NatSpecMultiLine
transferOwnership
function transferOwnership(address newOwner) public virtual onlyOwner { require( newOwner != address(0), "Ownable: new owner is the zero address" ); emit OwnershipTransferred(_owner, newOwner); _owner = newOwner; }
/** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */
NatSpecMultiLine
v0.8.7+commit.e28d00a7
MIT
ipfs://ba56817785df0acf93679ae6f6ce9a37dd503964e25888163ecfcef472d79be2
{ "func_code_index": [ 1475, 1761 ] }
2,307
FUNGI
openzeppelin-solidity\contracts\access\Ownable.sol
0xe918925a67b49897d0780b22b738610068a18bb4
Solidity
FUNGI
contract FUNGI is ERC721Enumerable, Ownable { using Counters for Counters.Counter; using Strings for uint256; uint256 public constant FUNGI_PUBLIC = 1111; uint256 public maxTotal = 1111; uint256 public constant FUNGI_MAX = FUNGI_PUBLIC; uint256 public constant PURCHASE_LIMIT = 100; uint256 public allowListMaxMint = 5; uint256 public constant PRICE = 40_000_000_000_000_000; // 0.04 ETH string private _contractURI = ""; string private _tokenBaseURI = ""; bool private _isActive = false; bool public isAllowListActive = false; mapping(address => bool) private _allowList; mapping(address => uint256) private _allowListClaimed; Counters.Counter private _publicFUNGI; constructor() ERC721("Fungi Queendom", "FUNGI") { } function setActive(bool isActive) external onlyOwner { _isActive = isActive; } function setContractURI(string memory URI) external onlyOwner { _contractURI = URI; } function setBaseURI(string memory URI) external onlyOwner { _tokenBaseURI = URI; } // minting function minting(address to, uint256 numberOfTokens) external payable onlyOwner { require( _publicFUNGI.current() < FUNGI_PUBLIC, "Purchase would exceed FUNGI_PUBLIC" ); for (uint256 i = 0; i < numberOfTokens; i++) { uint256 tokenId = _publicFUNGI.current(); if (_publicFUNGI.current() < FUNGI_PUBLIC) { _publicFUNGI.increment(); _safeMint(to, tokenId); } } } function setIsAllowListActive(bool _isAllowListActive) external onlyOwner { isAllowListActive = _isAllowListActive; } function setTotal(uint256 total) external onlyOwner { maxTotal = total; } function setAllowListMaxMint(uint256 maxMint) external onlyOwner { allowListMaxMint = maxMint; } function addToAllowList(address[] calldata addresses) external onlyOwner { for (uint256 i = 0; i < addresses.length; i++) { require(addresses[i] != address(0), "Can't add the null address"); _allowList[addresses[i]] = true; /** * @dev We don't want to reset _allowListClaimed count * if we try to add someone more than once. */ _allowListClaimed[addresses[i]] > 0 ? _allowListClaimed[addresses[i]] : 0; } } function allowListClaimedBy(address owner) external view returns (uint256){ require(owner != address(0), 'Zero address not on Allow List'); return _allowListClaimed[owner]; } function onAllowList(address addr) external view returns (bool) { return _allowList[addr]; } function removeFromAllowList(address[] calldata addresses) external onlyOwner { for (uint256 i = 0; i < addresses.length; i++) { require(addresses[i] != address(0), "Can't add the null address"); /// @dev We don't want to reset possible _allowListClaimed numbers. _allowList[addresses[i]] = false; } } function purchaseAllowList(uint256 numberOfTokens) external payable { require( numberOfTokens <= PURCHASE_LIMIT, "Can only mint up to 1 token" ); require(isAllowListActive, 'Allow List is not active'); require(_allowList[msg.sender], 'You are not on the Allow List'); require( _publicFUNGI.current() < FUNGI_PUBLIC, "Purchase would exceed max" ); require(numberOfTokens <= allowListMaxMint, 'Cannot purchase this many tokens'); require(_allowListClaimed[msg.sender] + numberOfTokens <= allowListMaxMint, 'Purchase exceeds max allowed'); require(PRICE * numberOfTokens <= msg.value, 'ETH amount is not sufficient'); require( _publicFUNGI.current() < FUNGI_PUBLIC, "Purchase would exceed FUNGI_PUBLIC" ); for (uint256 i = 0; i < numberOfTokens; i++) { uint256 tokenId = _publicFUNGI.current(); if (_publicFUNGI.current() < maxTotal) { _publicFUNGI.increment(); _safeMint(msg.sender, tokenId); } } } function purchase(uint256 numberOfTokens) external payable { require(_isActive, "Contract is not active"); require( numberOfTokens <= PURCHASE_LIMIT, "Can only mint up to 1 token" ); require( _publicFUNGI.current() < FUNGI_PUBLIC, "Purchase would exceed FUNGI_PUBLIC" ); require( PRICE * numberOfTokens <= msg.value, "ETH amount is not sufficient" ); for (uint256 i = 0; i < numberOfTokens; i++) { uint256 tokenId = _publicFUNGI.current(); if (_publicFUNGI.current() < maxTotal) { _publicFUNGI.increment(); _safeMint(msg.sender, tokenId); } } } function contractURI() public view returns (string memory) { return _contractURI; } function tokenURI(uint256 tokenId) public view override(ERC721) returns (string memory) { require(_exists(tokenId), "Token does not exist"); return string(abi.encodePacked(_tokenBaseURI, tokenId.toString())); } function withdraw() external onlyOwner { uint256 balance = address(this).balance; payable(msg.sender).transfer(balance); } }
minting
function minting(address to, uint256 numberOfTokens) external payable onlyOwner { require( _publicFUNGI.current() < FUNGI_PUBLIC, "Purchase would exceed FUNGI_PUBLIC" ); for (uint256 i = 0; i < numberOfTokens; i++) { uint256 tokenId = _publicFUNGI.current(); if (_publicFUNGI.current() < FUNGI_PUBLIC) { _publicFUNGI.increment(); _safeMint(to, tokenId); } } }
// minting
LineComment
v0.8.7+commit.e28d00a7
MIT
ipfs://ba56817785df0acf93679ae6f6ce9a37dd503964e25888163ecfcef472d79be2
{ "func_code_index": [ 1169, 1774 ] }
2,308
LoveToken
LoveToken.sol
0xe6efd46eb6cdd73a7fe1e760fa0c25a299755a4b
Solidity
SafeMath
library SafeMath { /** * @dev Multiplies two numbers, throws on overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { if (a == 0) { return 0; } uint256 c = a * b; assert(c / a == b); return c; } /** * @dev Integer division of two numbers, truncating the quotient. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { // assert(b > 0); // Solidity automatically throws when dividing by 0 uint256 c = a / b; // assert(a == b * c + a % b); // There is no case in which this doesn't hold return c; } /** * @dev Substracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend). */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { assert(b <= a); return a - b; } /** * @dev Adds two numbers, throws on overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; assert(c >= a); return c; } }
/** * @title SafeMath * @dev Math operations with safety checks that throw on error */
NatSpecMultiLine
mul
function mul(uint256 a, uint256 b) internal pure returns (uint256) { if (a == 0) { return 0; } uint256 c = a * b; assert(c / a == b); return c; }
/** * @dev Multiplies two numbers, throws on overflow. */
NatSpecMultiLine
v0.4.20-nightly.2018.1.6+commit.2548228b
bzzr://cc78a4e0c3026ffffa28e434e6fcb758666e6915aeab02fa212eadc76e6da781
{ "func_code_index": [ 89, 272 ] }
2,309
LoveToken
LoveToken.sol
0xe6efd46eb6cdd73a7fe1e760fa0c25a299755a4b
Solidity
SafeMath
library SafeMath { /** * @dev Multiplies two numbers, throws on overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { if (a == 0) { return 0; } uint256 c = a * b; assert(c / a == b); return c; } /** * @dev Integer division of two numbers, truncating the quotient. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { // assert(b > 0); // Solidity automatically throws when dividing by 0 uint256 c = a / b; // assert(a == b * c + a % b); // There is no case in which this doesn't hold return c; } /** * @dev Substracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend). */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { assert(b <= a); return a - b; } /** * @dev Adds two numbers, throws on overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; assert(c >= a); return c; } }
/** * @title SafeMath * @dev Math operations with safety checks that throw on error */
NatSpecMultiLine
div
function div(uint256 a, uint256 b) internal pure returns (uint256) { // assert(b > 0); // Solidity automatically throws when dividing by 0 uint256 c = a / b; // assert(a == b * c + a % b); // There is no case in which this doesn't hold return c; }
/** * @dev Integer division of two numbers, truncating the quotient. */
NatSpecMultiLine
v0.4.20-nightly.2018.1.6+commit.2548228b
bzzr://cc78a4e0c3026ffffa28e434e6fcb758666e6915aeab02fa212eadc76e6da781
{ "func_code_index": [ 356, 629 ] }
2,310
LoveToken
LoveToken.sol
0xe6efd46eb6cdd73a7fe1e760fa0c25a299755a4b
Solidity
SafeMath
library SafeMath { /** * @dev Multiplies two numbers, throws on overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { if (a == 0) { return 0; } uint256 c = a * b; assert(c / a == b); return c; } /** * @dev Integer division of two numbers, truncating the quotient. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { // assert(b > 0); // Solidity automatically throws when dividing by 0 uint256 c = a / b; // assert(a == b * c + a % b); // There is no case in which this doesn't hold return c; } /** * @dev Substracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend). */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { assert(b <= a); return a - b; } /** * @dev Adds two numbers, throws on overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; assert(c >= a); return c; } }
/** * @title SafeMath * @dev Math operations with safety checks that throw on error */
NatSpecMultiLine
sub
function sub(uint256 a, uint256 b) internal pure returns (uint256) { assert(b <= a); return a - b; }
/** * @dev Substracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend). */
NatSpecMultiLine
v0.4.20-nightly.2018.1.6+commit.2548228b
bzzr://cc78a4e0c3026ffffa28e434e6fcb758666e6915aeab02fa212eadc76e6da781
{ "func_code_index": [ 744, 860 ] }
2,311
LoveToken
LoveToken.sol
0xe6efd46eb6cdd73a7fe1e760fa0c25a299755a4b
Solidity
SafeMath
library SafeMath { /** * @dev Multiplies two numbers, throws on overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { if (a == 0) { return 0; } uint256 c = a * b; assert(c / a == b); return c; } /** * @dev Integer division of two numbers, truncating the quotient. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { // assert(b > 0); // Solidity automatically throws when dividing by 0 uint256 c = a / b; // assert(a == b * c + a % b); // There is no case in which this doesn't hold return c; } /** * @dev Substracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend). */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { assert(b <= a); return a - b; } /** * @dev Adds two numbers, throws on overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; assert(c >= a); return c; } }
/** * @title SafeMath * @dev Math operations with safety checks that throw on error */
NatSpecMultiLine
add
function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; assert(c >= a); return c; }
/** * @dev Adds two numbers, throws on overflow. */
NatSpecMultiLine
v0.4.20-nightly.2018.1.6+commit.2548228b
bzzr://cc78a4e0c3026ffffa28e434e6fcb758666e6915aeab02fa212eadc76e6da781
{ "func_code_index": [ 924, 1060 ] }
2,312
LoveToken
LoveToken.sol
0xe6efd46eb6cdd73a7fe1e760fa0c25a299755a4b
Solidity
BasicToken
contract BasicToken is ERC20Basic { using SafeMath for uint256; mapping(address => uint256) balances; uint256 totalSupply_; /** * @dev total number of tokens in existence */ function totalSupply() public view returns (uint256) { return totalSupply_; } /** * @dev transfer token for a specified address * @param _to The address to transfer to. * @param _value The amount to be transferred. */ function transfer(address _to, uint256 _value) public returns (bool) { require(_to != address(0)); require(_value <= balances[msg.sender]); // SafeMath.sub will throw if there is not enough balance. balances[msg.sender] = balances[msg.sender].sub(_value); balances[_to] = balances[_to].add(_value); Transfer(msg.sender, _to, _value); return true; } /** * @dev Gets the balance of the specified address. * @param _owner The address to query the the balance of. * @return An uint256 representing the amount owned by the passed address. */ function balanceOf(address _owner) public view returns (uint256 balance) { return balances[_owner]; } }
totalSupply
function totalSupply() public view returns (uint256) { return totalSupply_; }
/** * @dev total number of tokens in existence */
NatSpecMultiLine
v0.4.20-nightly.2018.1.6+commit.2548228b
bzzr://cc78a4e0c3026ffffa28e434e6fcb758666e6915aeab02fa212eadc76e6da781
{ "func_code_index": [ 199, 287 ] }
2,313
LoveToken
LoveToken.sol
0xe6efd46eb6cdd73a7fe1e760fa0c25a299755a4b
Solidity
BasicToken
contract BasicToken is ERC20Basic { using SafeMath for uint256; mapping(address => uint256) balances; uint256 totalSupply_; /** * @dev total number of tokens in existence */ function totalSupply() public view returns (uint256) { return totalSupply_; } /** * @dev transfer token for a specified address * @param _to The address to transfer to. * @param _value The amount to be transferred. */ function transfer(address _to, uint256 _value) public returns (bool) { require(_to != address(0)); require(_value <= balances[msg.sender]); // SafeMath.sub will throw if there is not enough balance. balances[msg.sender] = balances[msg.sender].sub(_value); balances[_to] = balances[_to].add(_value); Transfer(msg.sender, _to, _value); return true; } /** * @dev Gets the balance of the specified address. * @param _owner The address to query the the balance of. * @return An uint256 representing the amount owned by the passed address. */ function balanceOf(address _owner) public view returns (uint256 balance) { return balances[_owner]; } }
transfer
function transfer(address _to, uint256 _value) public returns (bool) { require(_to != address(0)); require(_value <= balances[msg.sender]); // SafeMath.sub will throw if there is not enough balance. balances[msg.sender] = balances[msg.sender].sub(_value); balances[_to] = balances[_to].add(_value); Transfer(msg.sender, _to, _value); return true; }
/** * @dev transfer token for a specified address * @param _to The address to transfer to. * @param _value The amount to be transferred. */
NatSpecMultiLine
v0.4.20-nightly.2018.1.6+commit.2548228b
bzzr://cc78a4e0c3026ffffa28e434e6fcb758666e6915aeab02fa212eadc76e6da781
{ "func_code_index": [ 445, 836 ] }
2,314
LoveToken
LoveToken.sol
0xe6efd46eb6cdd73a7fe1e760fa0c25a299755a4b
Solidity
BasicToken
contract BasicToken is ERC20Basic { using SafeMath for uint256; mapping(address => uint256) balances; uint256 totalSupply_; /** * @dev total number of tokens in existence */ function totalSupply() public view returns (uint256) { return totalSupply_; } /** * @dev transfer token for a specified address * @param _to The address to transfer to. * @param _value The amount to be transferred. */ function transfer(address _to, uint256 _value) public returns (bool) { require(_to != address(0)); require(_value <= balances[msg.sender]); // SafeMath.sub will throw if there is not enough balance. balances[msg.sender] = balances[msg.sender].sub(_value); balances[_to] = balances[_to].add(_value); Transfer(msg.sender, _to, _value); return true; } /** * @dev Gets the balance of the specified address. * @param _owner The address to query the the balance of. * @return An uint256 representing the amount owned by the passed address. */ function balanceOf(address _owner) public view returns (uint256 balance) { return balances[_owner]; } }
balanceOf
function balanceOf(address _owner) public view returns (uint256 balance) { return balances[_owner]; }
/** * @dev Gets the balance of the specified address. * @param _owner The address to query the the balance of. * @return An uint256 representing the amount owned by the passed address. */
NatSpecMultiLine
v0.4.20-nightly.2018.1.6+commit.2548228b
bzzr://cc78a4e0c3026ffffa28e434e6fcb758666e6915aeab02fa212eadc76e6da781
{ "func_code_index": [ 1042, 1154 ] }
2,315
LoveToken
LoveToken.sol
0xe6efd46eb6cdd73a7fe1e760fa0c25a299755a4b
Solidity
StandardToken
contract StandardToken is ERC20, BasicToken { mapping (address => mapping (address => uint256)) internal allowed; /** * @dev Transfer tokens from one address to another * @param _from address The address which you want to send tokens from * @param _to address The address which you want to transfer to * @param _value uint256 the amount of tokens to be transferred */ function transferFrom(address _from, address _to, uint256 _value) public returns (bool) { require(_to != address(0)); require(_value <= balances[_from]); require(_value <= allowed[_from][msg.sender]); balances[_from] = balances[_from].sub(_value); balances[_to] = balances[_to].add(_value); allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value); Transfer(_from, _to, _value); return true; } /** * @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender. * * Beware that changing an allowance with this method brings the risk that someone may use both the old * and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this * race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * @param _spender The address which will spend the funds. * @param _value The amount of tokens to be spent. */ function approve(address _spender, uint256 _value) public returns (bool) { allowed[msg.sender][_spender] = _value; Approval(msg.sender, _spender, _value); return true; } /** * @dev Function to check the amount of tokens that an owner allowed to a spender. * @param _owner address The address which owns the funds. * @param _spender address The address which will spend the funds. * @return A uint256 specifying the amount of tokens still available for the spender. */ function allowance(address _owner, address _spender) public view returns (uint256) { return allowed[_owner][_spender]; } /** * @dev Increase the amount of tokens that an owner allowed to a spender. * * approve should be called when allowed[_spender] == 0. To increment * allowed value is better to use this function to avoid 2 calls (and wait until * the first transaction is mined) * From MonolithDAO Token.sol * @param _spender The address which will spend the funds. * @param _addedValue The amount of tokens to increase the allowance by. */ function increaseApproval(address _spender, uint _addedValue) public returns (bool) { allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue); Approval(msg.sender, _spender, allowed[msg.sender][_spender]); return true; } /** * @dev Decrease the amount of tokens that an owner allowed to a spender. * * approve should be called when allowed[_spender] == 0. To decrement * allowed value is better to use this function to avoid 2 calls (and wait until * the first transaction is mined) * From MonolithDAO Token.sol * @param _spender The address which will spend the funds. * @param _subtractedValue The amount of tokens to decrease the allowance by. */ function decreaseApproval(address _spender, uint _subtractedValue) public returns (bool) { uint oldValue = allowed[msg.sender][_spender]; if (_subtractedValue > oldValue) { allowed[msg.sender][_spender] = 0; } else { allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue); } Approval(msg.sender, _spender, allowed[msg.sender][_spender]); return true; } }
transferFrom
function transferFrom(address _from, address _to, uint256 _value) public returns (bool) { require(_to != address(0)); require(_value <= balances[_from]); require(_value <= allowed[_from][msg.sender]); balances[_from] = balances[_from].sub(_value); balances[_to] = balances[_to].add(_value); allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value); Transfer(_from, _to, _value); return true; }
/** * @dev Transfer tokens from one address to another * @param _from address The address which you want to send tokens from * @param _to address The address which you want to transfer to * @param _value uint256 the amount of tokens to be transferred */
NatSpecMultiLine
v0.4.20-nightly.2018.1.6+commit.2548228b
bzzr://cc78a4e0c3026ffffa28e434e6fcb758666e6915aeab02fa212eadc76e6da781
{ "func_code_index": [ 401, 853 ] }
2,316
LoveToken
LoveToken.sol
0xe6efd46eb6cdd73a7fe1e760fa0c25a299755a4b
Solidity
StandardToken
contract StandardToken is ERC20, BasicToken { mapping (address => mapping (address => uint256)) internal allowed; /** * @dev Transfer tokens from one address to another * @param _from address The address which you want to send tokens from * @param _to address The address which you want to transfer to * @param _value uint256 the amount of tokens to be transferred */ function transferFrom(address _from, address _to, uint256 _value) public returns (bool) { require(_to != address(0)); require(_value <= balances[_from]); require(_value <= allowed[_from][msg.sender]); balances[_from] = balances[_from].sub(_value); balances[_to] = balances[_to].add(_value); allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value); Transfer(_from, _to, _value); return true; } /** * @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender. * * Beware that changing an allowance with this method brings the risk that someone may use both the old * and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this * race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * @param _spender The address which will spend the funds. * @param _value The amount of tokens to be spent. */ function approve(address _spender, uint256 _value) public returns (bool) { allowed[msg.sender][_spender] = _value; Approval(msg.sender, _spender, _value); return true; } /** * @dev Function to check the amount of tokens that an owner allowed to a spender. * @param _owner address The address which owns the funds. * @param _spender address The address which will spend the funds. * @return A uint256 specifying the amount of tokens still available for the spender. */ function allowance(address _owner, address _spender) public view returns (uint256) { return allowed[_owner][_spender]; } /** * @dev Increase the amount of tokens that an owner allowed to a spender. * * approve should be called when allowed[_spender] == 0. To increment * allowed value is better to use this function to avoid 2 calls (and wait until * the first transaction is mined) * From MonolithDAO Token.sol * @param _spender The address which will spend the funds. * @param _addedValue The amount of tokens to increase the allowance by. */ function increaseApproval(address _spender, uint _addedValue) public returns (bool) { allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue); Approval(msg.sender, _spender, allowed[msg.sender][_spender]); return true; } /** * @dev Decrease the amount of tokens that an owner allowed to a spender. * * approve should be called when allowed[_spender] == 0. To decrement * allowed value is better to use this function to avoid 2 calls (and wait until * the first transaction is mined) * From MonolithDAO Token.sol * @param _spender The address which will spend the funds. * @param _subtractedValue The amount of tokens to decrease the allowance by. */ function decreaseApproval(address _spender, uint _subtractedValue) public returns (bool) { uint oldValue = allowed[msg.sender][_spender]; if (_subtractedValue > oldValue) { allowed[msg.sender][_spender] = 0; } else { allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue); } Approval(msg.sender, _spender, allowed[msg.sender][_spender]); return true; } }
approve
function approve(address _spender, uint256 _value) public returns (bool) { allowed[msg.sender][_spender] = _value; Approval(msg.sender, _spender, _value); return true; }
/** * @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender. * * Beware that changing an allowance with this method brings the risk that someone may use both the old * and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this * race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * @param _spender The address which will spend the funds. * @param _value The amount of tokens to be spent. */
NatSpecMultiLine
v0.4.20-nightly.2018.1.6+commit.2548228b
bzzr://cc78a4e0c3026ffffa28e434e6fcb758666e6915aeab02fa212eadc76e6da781
{ "func_code_index": [ 1485, 1675 ] }
2,317
LoveToken
LoveToken.sol
0xe6efd46eb6cdd73a7fe1e760fa0c25a299755a4b
Solidity
StandardToken
contract StandardToken is ERC20, BasicToken { mapping (address => mapping (address => uint256)) internal allowed; /** * @dev Transfer tokens from one address to another * @param _from address The address which you want to send tokens from * @param _to address The address which you want to transfer to * @param _value uint256 the amount of tokens to be transferred */ function transferFrom(address _from, address _to, uint256 _value) public returns (bool) { require(_to != address(0)); require(_value <= balances[_from]); require(_value <= allowed[_from][msg.sender]); balances[_from] = balances[_from].sub(_value); balances[_to] = balances[_to].add(_value); allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value); Transfer(_from, _to, _value); return true; } /** * @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender. * * Beware that changing an allowance with this method brings the risk that someone may use both the old * and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this * race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * @param _spender The address which will spend the funds. * @param _value The amount of tokens to be spent. */ function approve(address _spender, uint256 _value) public returns (bool) { allowed[msg.sender][_spender] = _value; Approval(msg.sender, _spender, _value); return true; } /** * @dev Function to check the amount of tokens that an owner allowed to a spender. * @param _owner address The address which owns the funds. * @param _spender address The address which will spend the funds. * @return A uint256 specifying the amount of tokens still available for the spender. */ function allowance(address _owner, address _spender) public view returns (uint256) { return allowed[_owner][_spender]; } /** * @dev Increase the amount of tokens that an owner allowed to a spender. * * approve should be called when allowed[_spender] == 0. To increment * allowed value is better to use this function to avoid 2 calls (and wait until * the first transaction is mined) * From MonolithDAO Token.sol * @param _spender The address which will spend the funds. * @param _addedValue The amount of tokens to increase the allowance by. */ function increaseApproval(address _spender, uint _addedValue) public returns (bool) { allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue); Approval(msg.sender, _spender, allowed[msg.sender][_spender]); return true; } /** * @dev Decrease the amount of tokens that an owner allowed to a spender. * * approve should be called when allowed[_spender] == 0. To decrement * allowed value is better to use this function to avoid 2 calls (and wait until * the first transaction is mined) * From MonolithDAO Token.sol * @param _spender The address which will spend the funds. * @param _subtractedValue The amount of tokens to decrease the allowance by. */ function decreaseApproval(address _spender, uint _subtractedValue) public returns (bool) { uint oldValue = allowed[msg.sender][_spender]; if (_subtractedValue > oldValue) { allowed[msg.sender][_spender] = 0; } else { allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue); } Approval(msg.sender, _spender, allowed[msg.sender][_spender]); return true; } }
allowance
function allowance(address _owner, address _spender) public view returns (uint256) { return allowed[_owner][_spender]; }
/** * @dev Function to check the amount of tokens that an owner allowed to a spender. * @param _owner address The address which owns the funds. * @param _spender address The address which will spend the funds. * @return A uint256 specifying the amount of tokens still available for the spender. */
NatSpecMultiLine
v0.4.20-nightly.2018.1.6+commit.2548228b
bzzr://cc78a4e0c3026ffffa28e434e6fcb758666e6915aeab02fa212eadc76e6da781
{ "func_code_index": [ 1999, 2130 ] }
2,318
LoveToken
LoveToken.sol
0xe6efd46eb6cdd73a7fe1e760fa0c25a299755a4b
Solidity
StandardToken
contract StandardToken is ERC20, BasicToken { mapping (address => mapping (address => uint256)) internal allowed; /** * @dev Transfer tokens from one address to another * @param _from address The address which you want to send tokens from * @param _to address The address which you want to transfer to * @param _value uint256 the amount of tokens to be transferred */ function transferFrom(address _from, address _to, uint256 _value) public returns (bool) { require(_to != address(0)); require(_value <= balances[_from]); require(_value <= allowed[_from][msg.sender]); balances[_from] = balances[_from].sub(_value); balances[_to] = balances[_to].add(_value); allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value); Transfer(_from, _to, _value); return true; } /** * @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender. * * Beware that changing an allowance with this method brings the risk that someone may use both the old * and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this * race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * @param _spender The address which will spend the funds. * @param _value The amount of tokens to be spent. */ function approve(address _spender, uint256 _value) public returns (bool) { allowed[msg.sender][_spender] = _value; Approval(msg.sender, _spender, _value); return true; } /** * @dev Function to check the amount of tokens that an owner allowed to a spender. * @param _owner address The address which owns the funds. * @param _spender address The address which will spend the funds. * @return A uint256 specifying the amount of tokens still available for the spender. */ function allowance(address _owner, address _spender) public view returns (uint256) { return allowed[_owner][_spender]; } /** * @dev Increase the amount of tokens that an owner allowed to a spender. * * approve should be called when allowed[_spender] == 0. To increment * allowed value is better to use this function to avoid 2 calls (and wait until * the first transaction is mined) * From MonolithDAO Token.sol * @param _spender The address which will spend the funds. * @param _addedValue The amount of tokens to increase the allowance by. */ function increaseApproval(address _spender, uint _addedValue) public returns (bool) { allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue); Approval(msg.sender, _spender, allowed[msg.sender][_spender]); return true; } /** * @dev Decrease the amount of tokens that an owner allowed to a spender. * * approve should be called when allowed[_spender] == 0. To decrement * allowed value is better to use this function to avoid 2 calls (and wait until * the first transaction is mined) * From MonolithDAO Token.sol * @param _spender The address which will spend the funds. * @param _subtractedValue The amount of tokens to decrease the allowance by. */ function decreaseApproval(address _spender, uint _subtractedValue) public returns (bool) { uint oldValue = allowed[msg.sender][_spender]; if (_subtractedValue > oldValue) { allowed[msg.sender][_spender] = 0; } else { allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue); } Approval(msg.sender, _spender, allowed[msg.sender][_spender]); return true; } }
increaseApproval
function increaseApproval(address _spender, uint _addedValue) public returns (bool) { allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue); Approval(msg.sender, _spender, allowed[msg.sender][_spender]); return true; }
/** * @dev Increase the amount of tokens that an owner allowed to a spender. * * approve should be called when allowed[_spender] == 0. To increment * allowed value is better to use this function to avoid 2 calls (and wait until * the first transaction is mined) * From MonolithDAO Token.sol * @param _spender The address which will spend the funds. * @param _addedValue The amount of tokens to increase the allowance by. */
NatSpecMultiLine
v0.4.20-nightly.2018.1.6+commit.2548228b
bzzr://cc78a4e0c3026ffffa28e434e6fcb758666e6915aeab02fa212eadc76e6da781
{ "func_code_index": [ 2596, 2860 ] }
2,319
LoveToken
LoveToken.sol
0xe6efd46eb6cdd73a7fe1e760fa0c25a299755a4b
Solidity
StandardToken
contract StandardToken is ERC20, BasicToken { mapping (address => mapping (address => uint256)) internal allowed; /** * @dev Transfer tokens from one address to another * @param _from address The address which you want to send tokens from * @param _to address The address which you want to transfer to * @param _value uint256 the amount of tokens to be transferred */ function transferFrom(address _from, address _to, uint256 _value) public returns (bool) { require(_to != address(0)); require(_value <= balances[_from]); require(_value <= allowed[_from][msg.sender]); balances[_from] = balances[_from].sub(_value); balances[_to] = balances[_to].add(_value); allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value); Transfer(_from, _to, _value); return true; } /** * @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender. * * Beware that changing an allowance with this method brings the risk that someone may use both the old * and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this * race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * @param _spender The address which will spend the funds. * @param _value The amount of tokens to be spent. */ function approve(address _spender, uint256 _value) public returns (bool) { allowed[msg.sender][_spender] = _value; Approval(msg.sender, _spender, _value); return true; } /** * @dev Function to check the amount of tokens that an owner allowed to a spender. * @param _owner address The address which owns the funds. * @param _spender address The address which will spend the funds. * @return A uint256 specifying the amount of tokens still available for the spender. */ function allowance(address _owner, address _spender) public view returns (uint256) { return allowed[_owner][_spender]; } /** * @dev Increase the amount of tokens that an owner allowed to a spender. * * approve should be called when allowed[_spender] == 0. To increment * allowed value is better to use this function to avoid 2 calls (and wait until * the first transaction is mined) * From MonolithDAO Token.sol * @param _spender The address which will spend the funds. * @param _addedValue The amount of tokens to increase the allowance by. */ function increaseApproval(address _spender, uint _addedValue) public returns (bool) { allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue); Approval(msg.sender, _spender, allowed[msg.sender][_spender]); return true; } /** * @dev Decrease the amount of tokens that an owner allowed to a spender. * * approve should be called when allowed[_spender] == 0. To decrement * allowed value is better to use this function to avoid 2 calls (and wait until * the first transaction is mined) * From MonolithDAO Token.sol * @param _spender The address which will spend the funds. * @param _subtractedValue The amount of tokens to decrease the allowance by. */ function decreaseApproval(address _spender, uint _subtractedValue) public returns (bool) { uint oldValue = allowed[msg.sender][_spender]; if (_subtractedValue > oldValue) { allowed[msg.sender][_spender] = 0; } else { allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue); } Approval(msg.sender, _spender, allowed[msg.sender][_spender]); return true; } }
decreaseApproval
function decreaseApproval(address _spender, uint _subtractedValue) public returns (bool) { uint oldValue = allowed[msg.sender][_spender]; if (_subtractedValue > oldValue) { allowed[msg.sender][_spender] = 0; } else { allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue); } Approval(msg.sender, _spender, allowed[msg.sender][_spender]); return true; }
/** * @dev Decrease the amount of tokens that an owner allowed to a spender. * * approve should be called when allowed[_spender] == 0. To decrement * allowed value is better to use this function to avoid 2 calls (and wait until * the first transaction is mined) * From MonolithDAO Token.sol * @param _spender The address which will spend the funds. * @param _subtractedValue The amount of tokens to decrease the allowance by. */
NatSpecMultiLine
v0.4.20-nightly.2018.1.6+commit.2548228b
bzzr://cc78a4e0c3026ffffa28e434e6fcb758666e6915aeab02fa212eadc76e6da781
{ "func_code_index": [ 3331, 3741 ] }
2,320
LoveToken
LoveToken.sol
0xe6efd46eb6cdd73a7fe1e760fa0c25a299755a4b
Solidity
Ownable
contract Ownable { address public owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev The Ownable constructor sets the original `owner` of the contract to the sender * account. */ function Ownable() public { owner = msg.sender; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(msg.sender == owner); _; } /** * @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 { require(newOwner != address(0)); OwnershipTransferred(owner, newOwner); owner = newOwner; } }
Ownable
function Ownable() public { owner = msg.sender; }
/** * @dev The Ownable constructor sets the original `owner` of the contract to the sender * account. */
NatSpecMultiLine
v0.4.20-nightly.2018.1.6+commit.2548228b
bzzr://cc78a4e0c3026ffffa28e434e6fcb758666e6915aeab02fa212eadc76e6da781
{ "func_code_index": [ 261, 321 ] }
2,321
LoveToken
LoveToken.sol
0xe6efd46eb6cdd73a7fe1e760fa0c25a299755a4b
Solidity
Ownable
contract Ownable { address public owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev The Ownable constructor sets the original `owner` of the contract to the sender * account. */ function Ownable() public { owner = msg.sender; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(msg.sender == owner); _; } /** * @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 { require(newOwner != address(0)); OwnershipTransferred(owner, newOwner); owner = newOwner; } }
transferOwnership
function transferOwnership(address newOwner) public onlyOwner { require(newOwner != address(0)); OwnershipTransferred(owner, newOwner); owner = 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.4.20-nightly.2018.1.6+commit.2548228b
bzzr://cc78a4e0c3026ffffa28e434e6fcb758666e6915aeab02fa212eadc76e6da781
{ "func_code_index": [ 640, 816 ] }
2,322
LoveToken
LoveToken.sol
0xe6efd46eb6cdd73a7fe1e760fa0c25a299755a4b
Solidity
Pausable
contract Pausable is Ownable { 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); _; } /** * @dev Modifier to make a function callable only when the contract is paused. */ modifier whenPaused() { require(paused); _; } /** * @dev called by the owner to pause, triggers stopped state */ function pause() onlyOwner whenNotPaused public { paused = true; Pause(); } /** * @dev called by the owner to unpause, returns to normal state */ function unpause() onlyOwner whenPaused public { paused = false; Unpause(); } }
pause
function pause() onlyOwner whenNotPaused public { paused = true; Pause(); }
/** * @dev called by the owner to pause, triggers stopped state */
NatSpecMultiLine
v0.4.20-nightly.2018.1.6+commit.2548228b
bzzr://cc78a4e0c3026ffffa28e434e6fcb758666e6915aeab02fa212eadc76e6da781
{ "func_code_index": [ 513, 604 ] }
2,323
LoveToken
LoveToken.sol
0xe6efd46eb6cdd73a7fe1e760fa0c25a299755a4b
Solidity
Pausable
contract Pausable is Ownable { 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); _; } /** * @dev Modifier to make a function callable only when the contract is paused. */ modifier whenPaused() { require(paused); _; } /** * @dev called by the owner to pause, triggers stopped state */ function pause() onlyOwner whenNotPaused public { paused = true; Pause(); } /** * @dev called by the owner to unpause, returns to normal state */ function unpause() onlyOwner whenPaused public { paused = false; Unpause(); } }
unpause
function unpause() onlyOwner whenPaused public { paused = false; Unpause(); }
/** * @dev called by the owner to unpause, returns to normal state */
NatSpecMultiLine
v0.4.20-nightly.2018.1.6+commit.2548228b
bzzr://cc78a4e0c3026ffffa28e434e6fcb758666e6915aeab02fa212eadc76e6da781
{ "func_code_index": [ 688, 781 ] }
2,324
LoveToken
LoveToken.sol
0xe6efd46eb6cdd73a7fe1e760fa0c25a299755a4b
Solidity
MintableToken
contract MintableToken is StandardToken, Ownable { event Mint(address indexed to, uint256 amount); event MintFinished(); bool public mintingFinished = false; modifier canMint() { require(!mintingFinished); _; } /** * @dev Function to mint tokens * @param _to The address that will receive the minted tokens. * @param _amount The amount of tokens to mint. * @return A boolean that indicates if the operation was successful. */ function mint(address _to, uint256 _amount) onlyOwner canMint public returns (bool) { totalSupply_ = totalSupply_.add(_amount); balances[_to] = balances[_to].add(_amount); Mint(_to, _amount); Transfer(address(0), _to, _amount); return true; } /** * @dev Function to stop minting new tokens. * @return True if the operation was successful. */ function finishMinting() onlyOwner canMint public returns (bool) { mintingFinished = true; MintFinished(); return true; } }
mint
function mint(address _to, uint256 _amount) onlyOwner canMint public returns (bool) { totalSupply_ = totalSupply_.add(_amount); balances[_to] = balances[_to].add(_amount); Mint(_to, _amount); Transfer(address(0), _to, _amount); return true; }
/** * @dev Function to mint tokens * @param _to The address that will receive the minted tokens. * @param _amount The amount of tokens to mint. * @return A boolean that indicates if the operation was successful. */
NatSpecMultiLine
v0.4.20-nightly.2018.1.6+commit.2548228b
bzzr://cc78a4e0c3026ffffa28e434e6fcb758666e6915aeab02fa212eadc76e6da781
{ "func_code_index": [ 483, 756 ] }
2,325
LoveToken
LoveToken.sol
0xe6efd46eb6cdd73a7fe1e760fa0c25a299755a4b
Solidity
MintableToken
contract MintableToken is StandardToken, Ownable { event Mint(address indexed to, uint256 amount); event MintFinished(); bool public mintingFinished = false; modifier canMint() { require(!mintingFinished); _; } /** * @dev Function to mint tokens * @param _to The address that will receive the minted tokens. * @param _amount The amount of tokens to mint. * @return A boolean that indicates if the operation was successful. */ function mint(address _to, uint256 _amount) onlyOwner canMint public returns (bool) { totalSupply_ = totalSupply_.add(_amount); balances[_to] = balances[_to].add(_amount); Mint(_to, _amount); Transfer(address(0), _to, _amount); return true; } /** * @dev Function to stop minting new tokens. * @return True if the operation was successful. */ function finishMinting() onlyOwner canMint public returns (bool) { mintingFinished = true; MintFinished(); return true; } }
finishMinting
function finishMinting() onlyOwner canMint public returns (bool) { mintingFinished = true; MintFinished(); return true; }
/** * @dev Function to stop minting new tokens. * @return True if the operation was successful. */
NatSpecMultiLine
v0.4.20-nightly.2018.1.6+commit.2548228b
bzzr://cc78a4e0c3026ffffa28e434e6fcb758666e6915aeab02fa212eadc76e6da781
{ "func_code_index": [ 873, 1015 ] }
2,326
AkoinToken
AkoinToken.sol
0x514e3d7c6b9b831903a93916b31e06ad2037b619
Solidity
SafeMath
library SafeMath { /** * @dev Multiplies two numbers, throws on overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256 c) { // Gas optimization: this is cheaper than asserting 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522 if (a == 0) { return 0; } c = a * b; assert(c / a == b); return c; } /** * @dev Integer division of two numbers, truncating the quotient. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { // assert(b > 0); // Solidity automatically throws when dividing by 0 // uint256 c = a / b; // assert(a == b * c + a % b); // There is no case in which this doesn't hold return a / b; } /** * @dev Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend). */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { assert(b <= a); return a - b; } /** * @dev Adds two numbers, throws on overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256 c) { c = a + b; assert(c >= a); return c; } }
/** * @title SafeMath * @dev Math operations with safety checks that throw on error */
NatSpecMultiLine
mul
function mul(uint256 a, uint256 b) internal pure returns (uint256 c) { // Gas optimization: this is cheaper than asserting 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522 if (a == 0) { return 0; } c = a * b; assert(c / a == b); return c; }
/** * @dev Multiplies two numbers, throws on overflow. */
NatSpecMultiLine
v0.4.23+commit.124ca40d
bzzr://cc26b86a6bcd38b51ac4751ab4b9133535cabb1b8d0f44892199a93cfad754c6
{ "func_code_index": [ 89, 476 ] }
2,327
AkoinToken
AkoinToken.sol
0x514e3d7c6b9b831903a93916b31e06ad2037b619
Solidity
SafeMath
library SafeMath { /** * @dev Multiplies two numbers, throws on overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256 c) { // Gas optimization: this is cheaper than asserting 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522 if (a == 0) { return 0; } c = a * b; assert(c / a == b); return c; } /** * @dev Integer division of two numbers, truncating the quotient. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { // assert(b > 0); // Solidity automatically throws when dividing by 0 // uint256 c = a / b; // assert(a == b * c + a % b); // There is no case in which this doesn't hold return a / b; } /** * @dev Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend). */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { assert(b <= a); return a - b; } /** * @dev Adds two numbers, throws on overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256 c) { c = a + b; assert(c >= a); return c; } }
/** * @title SafeMath * @dev Math operations with safety checks that throw on error */
NatSpecMultiLine
div
function div(uint256 a, uint256 b) internal pure returns (uint256) { // assert(b > 0); // Solidity automatically throws when dividing by 0 // uint256 c = a / b; // assert(a == b * c + a % b); // There is no case in which this doesn't hold return a / b; }
/** * @dev Integer division of two numbers, truncating the quotient. */
NatSpecMultiLine
v0.4.23+commit.124ca40d
bzzr://cc26b86a6bcd38b51ac4751ab4b9133535cabb1b8d0f44892199a93cfad754c6
{ "func_code_index": [ 560, 840 ] }
2,328
AkoinToken
AkoinToken.sol
0x514e3d7c6b9b831903a93916b31e06ad2037b619
Solidity
SafeMath
library SafeMath { /** * @dev Multiplies two numbers, throws on overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256 c) { // Gas optimization: this is cheaper than asserting 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522 if (a == 0) { return 0; } c = a * b; assert(c / a == b); return c; } /** * @dev Integer division of two numbers, truncating the quotient. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { // assert(b > 0); // Solidity automatically throws when dividing by 0 // uint256 c = a / b; // assert(a == b * c + a % b); // There is no case in which this doesn't hold return a / b; } /** * @dev Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend). */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { assert(b <= a); return a - b; } /** * @dev Adds two numbers, throws on overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256 c) { c = a + b; assert(c >= a); return c; } }
/** * @title SafeMath * @dev Math operations with safety checks that throw on error */
NatSpecMultiLine
sub
function sub(uint256 a, uint256 b) internal pure returns (uint256) { assert(b <= a); return a - b; }
/** * @dev Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend). */
NatSpecMultiLine
v0.4.23+commit.124ca40d
bzzr://cc26b86a6bcd38b51ac4751ab4b9133535cabb1b8d0f44892199a93cfad754c6
{ "func_code_index": [ 954, 1070 ] }
2,329
AkoinToken
AkoinToken.sol
0x514e3d7c6b9b831903a93916b31e06ad2037b619
Solidity
SafeMath
library SafeMath { /** * @dev Multiplies two numbers, throws on overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256 c) { // Gas optimization: this is cheaper than asserting 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522 if (a == 0) { return 0; } c = a * b; assert(c / a == b); return c; } /** * @dev Integer division of two numbers, truncating the quotient. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { // assert(b > 0); // Solidity automatically throws when dividing by 0 // uint256 c = a / b; // assert(a == b * c + a % b); // There is no case in which this doesn't hold return a / b; } /** * @dev Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend). */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { assert(b <= a); return a - b; } /** * @dev Adds two numbers, throws on overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256 c) { c = a + b; assert(c >= a); return c; } }
/** * @title SafeMath * @dev Math operations with safety checks that throw on error */
NatSpecMultiLine
add
function add(uint256 a, uint256 b) internal pure returns (uint256 c) { c = a + b; assert(c >= a); return c; }
/** * @dev Adds two numbers, throws on overflow. */
NatSpecMultiLine
v0.4.23+commit.124ca40d
bzzr://cc26b86a6bcd38b51ac4751ab4b9133535cabb1b8d0f44892199a93cfad754c6
{ "func_code_index": [ 1134, 1264 ] }
2,330
AkoinToken
AkoinToken.sol
0x514e3d7c6b9b831903a93916b31e06ad2037b619
Solidity
Ownable
contract Ownable { address public owner; event OwnershipTransferred( address indexed previousOwner, address indexed newOwner ); /** * @dev The Ownable constructor sets the original `owner` of the contract to the sender * account. */ constructor() public { owner = msg.sender; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(msg.sender == owner); _; } /** * @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)); emit OwnershipTransferred(owner, _newOwner); owner = _newOwner; } }
/** * @title Ownable * @dev The Ownable contract has an owner address, and provides basic authorization control * functions, this simplifies the implementation of "user permissions". */
NatSpecMultiLine
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.4.23+commit.124ca40d
bzzr://cc26b86a6bcd38b51ac4751ab4b9133535cabb1b8d0f44892199a93cfad754c6
{ "func_code_index": [ 656, 764 ] }
2,331
AkoinToken
AkoinToken.sol
0x514e3d7c6b9b831903a93916b31e06ad2037b619
Solidity
Ownable
contract Ownable { address public owner; event OwnershipTransferred( address indexed previousOwner, address indexed newOwner ); /** * @dev The Ownable constructor sets the original `owner` of the contract to the sender * account. */ constructor() public { owner = msg.sender; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(msg.sender == owner); _; } /** * @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)); emit OwnershipTransferred(owner, _newOwner); owner = _newOwner; } }
/** * @title Ownable * @dev The Ownable contract has an owner address, and provides basic authorization control * functions, this simplifies the implementation of "user permissions". */
NatSpecMultiLine
_transferOwnership
function _transferOwnership(address _newOwner) internal { require(_newOwner != address(0)); 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.4.23+commit.124ca40d
bzzr://cc26b86a6bcd38b51ac4751ab4b9133535cabb1b8d0f44892199a93cfad754c6
{ "func_code_index": [ 902, 1080 ] }
2,332
AkoinToken
AkoinToken.sol
0x514e3d7c6b9b831903a93916b31e06ad2037b619
Solidity
Pausable
contract Pausable is Ownable { 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); _; } /** * @dev Modifier to make a function callable only when the contract is paused. */ modifier whenPaused() { require(paused); _; } /** * @dev called by the owner to pause, triggers stopped state */ function pause() onlyOwner whenNotPaused public { paused = true; emit Pause(); } /** * @dev called by the owner to unpause, returns to normal state */ function unpause() onlyOwner whenPaused public { paused = false; emit Unpause(); } }
/** * @title Pausable * @dev Base contract which allows children to implement an emergency stop mechanism. */
NatSpecMultiLine
pause
function pause() onlyOwner whenNotPaused public { paused = true; emit Pause(); }
/** * @dev called by the owner to pause, triggers stopped state */
NatSpecMultiLine
v0.4.23+commit.124ca40d
bzzr://cc26b86a6bcd38b51ac4751ab4b9133535cabb1b8d0f44892199a93cfad754c6
{ "func_code_index": [ 513, 609 ] }
2,333
AkoinToken
AkoinToken.sol
0x514e3d7c6b9b831903a93916b31e06ad2037b619
Solidity
Pausable
contract Pausable is Ownable { 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); _; } /** * @dev Modifier to make a function callable only when the contract is paused. */ modifier whenPaused() { require(paused); _; } /** * @dev called by the owner to pause, triggers stopped state */ function pause() onlyOwner whenNotPaused public { paused = true; emit Pause(); } /** * @dev called by the owner to unpause, returns to normal state */ function unpause() onlyOwner whenPaused public { paused = false; emit Unpause(); } }
/** * @title Pausable * @dev Base contract which allows children to implement an emergency stop mechanism. */
NatSpecMultiLine
unpause
function unpause() onlyOwner whenPaused public { paused = false; emit Unpause(); }
/** * @dev called by the owner to unpause, returns to normal state */
NatSpecMultiLine
v0.4.23+commit.124ca40d
bzzr://cc26b86a6bcd38b51ac4751ab4b9133535cabb1b8d0f44892199a93cfad754c6
{ "func_code_index": [ 693, 791 ] }
2,334
AkoinToken
AkoinToken.sol
0x514e3d7c6b9b831903a93916b31e06ad2037b619
Solidity
BasicToken
contract BasicToken is ERC20Basic, Ownable { using SafeMath for uint256; mapping(address => uint256) balances; uint256 totalSupply_; /** * @dev Total number of tokens in existence */ function totalSupply() public view returns (uint256) { return totalSupply_; } /** * @dev Transfer token for a specified address * @param _to The address to transfer to. * @param _value The amount to be transferred. */ function transfer(address _to, uint256 _value) public returns (bool) { require(_to != address(0)); require(_value <= balances[msg.sender]); balances[msg.sender] = balances[msg.sender].sub(_value); balances[_to] = balances[_to].add(_value); emit Transfer(msg.sender, _to, _value); return true; } /** * @dev Gets the balance of the specified address. * @param _owner The address to query the the balance of. * @return An uint256 representing the amount owned by the passed address. */ function balanceOf(address _owner) public view returns (uint256) { return balances[_owner]; } }
/** * @title Basic token * @dev Basic version of StandardToken, with no allowances. */
NatSpecMultiLine
totalSupply
function totalSupply() public view returns (uint256) { return totalSupply_; }
/** * @dev Total number of tokens in existence */
NatSpecMultiLine
v0.4.23+commit.124ca40d
bzzr://cc26b86a6bcd38b51ac4751ab4b9133535cabb1b8d0f44892199a93cfad754c6
{ "func_code_index": [ 208, 296 ] }
2,335
AkoinToken
AkoinToken.sol
0x514e3d7c6b9b831903a93916b31e06ad2037b619
Solidity
BasicToken
contract BasicToken is ERC20Basic, Ownable { using SafeMath for uint256; mapping(address => uint256) balances; uint256 totalSupply_; /** * @dev Total number of tokens in existence */ function totalSupply() public view returns (uint256) { return totalSupply_; } /** * @dev Transfer token for a specified address * @param _to The address to transfer to. * @param _value The amount to be transferred. */ function transfer(address _to, uint256 _value) public returns (bool) { require(_to != address(0)); require(_value <= balances[msg.sender]); balances[msg.sender] = balances[msg.sender].sub(_value); balances[_to] = balances[_to].add(_value); emit Transfer(msg.sender, _to, _value); return true; } /** * @dev Gets the balance of the specified address. * @param _owner The address to query the the balance of. * @return An uint256 representing the amount owned by the passed address. */ function balanceOf(address _owner) public view returns (uint256) { return balances[_owner]; } }
/** * @title Basic token * @dev Basic version of StandardToken, with no allowances. */
NatSpecMultiLine
transfer
function transfer(address _to, uint256 _value) public returns (bool) { require(_to != address(0)); require(_value <= balances[msg.sender]); balances[msg.sender] = balances[msg.sender].sub(_value); balances[_to] = balances[_to].add(_value); emit Transfer(msg.sender, _to, _value); return true; }
/** * @dev Transfer token for a specified address * @param _to The address to transfer to. * @param _value The amount to be transferred. */
NatSpecMultiLine
v0.4.23+commit.124ca40d
bzzr://cc26b86a6bcd38b51ac4751ab4b9133535cabb1b8d0f44892199a93cfad754c6
{ "func_code_index": [ 454, 786 ] }
2,336
AkoinToken
AkoinToken.sol
0x514e3d7c6b9b831903a93916b31e06ad2037b619
Solidity
BasicToken
contract BasicToken is ERC20Basic, Ownable { using SafeMath for uint256; mapping(address => uint256) balances; uint256 totalSupply_; /** * @dev Total number of tokens in existence */ function totalSupply() public view returns (uint256) { return totalSupply_; } /** * @dev Transfer token for a specified address * @param _to The address to transfer to. * @param _value The amount to be transferred. */ function transfer(address _to, uint256 _value) public returns (bool) { require(_to != address(0)); require(_value <= balances[msg.sender]); balances[msg.sender] = balances[msg.sender].sub(_value); balances[_to] = balances[_to].add(_value); emit Transfer(msg.sender, _to, _value); return true; } /** * @dev Gets the balance of the specified address. * @param _owner The address to query the the balance of. * @return An uint256 representing the amount owned by the passed address. */ function balanceOf(address _owner) public view returns (uint256) { return balances[_owner]; } }
/** * @title Basic token * @dev Basic version of StandardToken, with no allowances. */
NatSpecMultiLine
balanceOf
function balanceOf(address _owner) public view returns (uint256) { return balances[_owner]; }
/** * @dev Gets the balance of the specified address. * @param _owner The address to query the the balance of. * @return An uint256 representing the amount owned by the passed address. */
NatSpecMultiLine
v0.4.23+commit.124ca40d
bzzr://cc26b86a6bcd38b51ac4751ab4b9133535cabb1b8d0f44892199a93cfad754c6
{ "func_code_index": [ 992, 1096 ] }
2,337
AkoinToken
AkoinToken.sol
0x514e3d7c6b9b831903a93916b31e06ad2037b619
Solidity
StandardToken
contract StandardToken is ERC20, BasicToken { mapping (address => mapping (address => uint256)) internal allowed; /** * @dev Transfer tokens from one address to another * @param _from address The address which you want to send tokens from * @param _to address The address which you want to transfer to * @param _value uint256 the amount of tokens to be transferred */ function transferFrom( address _from, address _to, uint256 _value ) public returns (bool) { require(_to != address(0)); require(_value <= balances[_from]); require(_value <= allowed[_from][msg.sender]); balances[_from] = balances[_from].sub(_value); balances[_to] = balances[_to].add(_value); allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value); emit Transfer(_from, _to, _value); return true; } /** * @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender. * * Beware that changing an allowance with this method brings the risk that someone may use both the old * and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this * race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * @param _spender The address which will spend the funds. * @param _value The amount of tokens to be spent. */ function approve(address _spender, uint256 _value) public returns (bool) { allowed[msg.sender][_spender] = _value; emit Approval(msg.sender, _spender, _value); return true; } /** * @dev Function to check the amount of tokens that an owner allowed to a spender. * @param _owner address The address which owns the funds. * @param _spender address The address which will spend the funds. * @return A uint256 specifying the amount of tokens still available for the spender. */ function allowance( address _owner, address _spender ) public view returns (uint256) { return allowed[_owner][_spender]; } /** * @dev Function to revert eth transfers to this contract */ function() public payable { revert(); } /** * @dev Owner can transfer out any accidentally sent ERC20 tokens */ function transferAnyERC20Token(address tokenAddress, uint tokens) public onlyOwner returns (bool success) { return BasicToken(tokenAddress).transfer(owner, tokens); } }
/** * @title Standard ERC20 token * * @dev Implementation of the basic standard token. * @dev https://github.com/ethereum/EIPs/issues/20 * @dev Based on code by FirstBlood: https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol */
NatSpecMultiLine
transferFrom
function transferFrom( address _from, address _to, uint256 _value ) public returns (bool) { require(_to != address(0)); require(_value <= balances[_from]); require(_value <= allowed[_from][msg.sender]); balances[_from] = balances[_from].sub(_value); balances[_to] = balances[_to].add(_value); allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value); emit Transfer(_from, _to, _value); return true; }
/** * @dev Transfer tokens from one address to another * @param _from address The address which you want to send tokens from * @param _to address The address which you want to transfer to * @param _value uint256 the amount of tokens to be transferred */
NatSpecMultiLine
v0.4.23+commit.124ca40d
bzzr://cc26b86a6bcd38b51ac4751ab4b9133535cabb1b8d0f44892199a93cfad754c6
{ "func_code_index": [ 401, 891 ] }
2,338
AkoinToken
AkoinToken.sol
0x514e3d7c6b9b831903a93916b31e06ad2037b619
Solidity
StandardToken
contract StandardToken is ERC20, BasicToken { mapping (address => mapping (address => uint256)) internal allowed; /** * @dev Transfer tokens from one address to another * @param _from address The address which you want to send tokens from * @param _to address The address which you want to transfer to * @param _value uint256 the amount of tokens to be transferred */ function transferFrom( address _from, address _to, uint256 _value ) public returns (bool) { require(_to != address(0)); require(_value <= balances[_from]); require(_value <= allowed[_from][msg.sender]); balances[_from] = balances[_from].sub(_value); balances[_to] = balances[_to].add(_value); allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value); emit Transfer(_from, _to, _value); return true; } /** * @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender. * * Beware that changing an allowance with this method brings the risk that someone may use both the old * and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this * race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * @param _spender The address which will spend the funds. * @param _value The amount of tokens to be spent. */ function approve(address _spender, uint256 _value) public returns (bool) { allowed[msg.sender][_spender] = _value; emit Approval(msg.sender, _spender, _value); return true; } /** * @dev Function to check the amount of tokens that an owner allowed to a spender. * @param _owner address The address which owns the funds. * @param _spender address The address which will spend the funds. * @return A uint256 specifying the amount of tokens still available for the spender. */ function allowance( address _owner, address _spender ) public view returns (uint256) { return allowed[_owner][_spender]; } /** * @dev Function to revert eth transfers to this contract */ function() public payable { revert(); } /** * @dev Owner can transfer out any accidentally sent ERC20 tokens */ function transferAnyERC20Token(address tokenAddress, uint tokens) public onlyOwner returns (bool success) { return BasicToken(tokenAddress).transfer(owner, tokens); } }
/** * @title Standard ERC20 token * * @dev Implementation of the basic standard token. * @dev https://github.com/ethereum/EIPs/issues/20 * @dev Based on code by FirstBlood: https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol */
NatSpecMultiLine
approve
function approve(address _spender, uint256 _value) public returns (bool) { allowed[msg.sender][_spender] = _value; emit Approval(msg.sender, _spender, _value); return true; }
/** * @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender. * * Beware that changing an allowance with this method brings the risk that someone may use both the old * and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this * race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * @param _spender The address which will spend the funds. * @param _value The amount of tokens to be spent. */
NatSpecMultiLine
v0.4.23+commit.124ca40d
bzzr://cc26b86a6bcd38b51ac4751ab4b9133535cabb1b8d0f44892199a93cfad754c6
{ "func_code_index": [ 1523, 1718 ] }
2,339
AkoinToken
AkoinToken.sol
0x514e3d7c6b9b831903a93916b31e06ad2037b619
Solidity
StandardToken
contract StandardToken is ERC20, BasicToken { mapping (address => mapping (address => uint256)) internal allowed; /** * @dev Transfer tokens from one address to another * @param _from address The address which you want to send tokens from * @param _to address The address which you want to transfer to * @param _value uint256 the amount of tokens to be transferred */ function transferFrom( address _from, address _to, uint256 _value ) public returns (bool) { require(_to != address(0)); require(_value <= balances[_from]); require(_value <= allowed[_from][msg.sender]); balances[_from] = balances[_from].sub(_value); balances[_to] = balances[_to].add(_value); allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value); emit Transfer(_from, _to, _value); return true; } /** * @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender. * * Beware that changing an allowance with this method brings the risk that someone may use both the old * and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this * race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * @param _spender The address which will spend the funds. * @param _value The amount of tokens to be spent. */ function approve(address _spender, uint256 _value) public returns (bool) { allowed[msg.sender][_spender] = _value; emit Approval(msg.sender, _spender, _value); return true; } /** * @dev Function to check the amount of tokens that an owner allowed to a spender. * @param _owner address The address which owns the funds. * @param _spender address The address which will spend the funds. * @return A uint256 specifying the amount of tokens still available for the spender. */ function allowance( address _owner, address _spender ) public view returns (uint256) { return allowed[_owner][_spender]; } /** * @dev Function to revert eth transfers to this contract */ function() public payable { revert(); } /** * @dev Owner can transfer out any accidentally sent ERC20 tokens */ function transferAnyERC20Token(address tokenAddress, uint tokens) public onlyOwner returns (bool success) { return BasicToken(tokenAddress).transfer(owner, tokens); } }
/** * @title Standard ERC20 token * * @dev Implementation of the basic standard token. * @dev https://github.com/ethereum/EIPs/issues/20 * @dev Based on code by FirstBlood: https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol */
NatSpecMultiLine
allowance
function allowance( address _owner, address _spender ) public view returns (uint256) { return allowed[_owner][_spender]; }
/** * @dev Function to check the amount of tokens that an owner allowed to a spender. * @param _owner address The address which owns the funds. * @param _spender address The address which will spend the funds. * @return A uint256 specifying the amount of tokens still available for the spender. */
NatSpecMultiLine
v0.4.23+commit.124ca40d
bzzr://cc26b86a6bcd38b51ac4751ab4b9133535cabb1b8d0f44892199a93cfad754c6
{ "func_code_index": [ 2042, 2207 ] }
2,340
AkoinToken
AkoinToken.sol
0x514e3d7c6b9b831903a93916b31e06ad2037b619
Solidity
StandardToken
contract StandardToken is ERC20, BasicToken { mapping (address => mapping (address => uint256)) internal allowed; /** * @dev Transfer tokens from one address to another * @param _from address The address which you want to send tokens from * @param _to address The address which you want to transfer to * @param _value uint256 the amount of tokens to be transferred */ function transferFrom( address _from, address _to, uint256 _value ) public returns (bool) { require(_to != address(0)); require(_value <= balances[_from]); require(_value <= allowed[_from][msg.sender]); balances[_from] = balances[_from].sub(_value); balances[_to] = balances[_to].add(_value); allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value); emit Transfer(_from, _to, _value); return true; } /** * @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender. * * Beware that changing an allowance with this method brings the risk that someone may use both the old * and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this * race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * @param _spender The address which will spend the funds. * @param _value The amount of tokens to be spent. */ function approve(address _spender, uint256 _value) public returns (bool) { allowed[msg.sender][_spender] = _value; emit Approval(msg.sender, _spender, _value); return true; } /** * @dev Function to check the amount of tokens that an owner allowed to a spender. * @param _owner address The address which owns the funds. * @param _spender address The address which will spend the funds. * @return A uint256 specifying the amount of tokens still available for the spender. */ function allowance( address _owner, address _spender ) public view returns (uint256) { return allowed[_owner][_spender]; } /** * @dev Function to revert eth transfers to this contract */ function() public payable { revert(); } /** * @dev Owner can transfer out any accidentally sent ERC20 tokens */ function transferAnyERC20Token(address tokenAddress, uint tokens) public onlyOwner returns (bool success) { return BasicToken(tokenAddress).transfer(owner, tokens); } }
/** * @title Standard ERC20 token * * @dev Implementation of the basic standard token. * @dev https://github.com/ethereum/EIPs/issues/20 * @dev Based on code by FirstBlood: https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol */
NatSpecMultiLine
function() public payable { revert();
/** * @dev Function to revert eth transfers to this contract */
NatSpecMultiLine
v0.4.23+commit.124ca40d
bzzr://cc26b86a6bcd38b51ac4751ab4b9133535cabb1b8d0f44892199a93cfad754c6
{ "func_code_index": [ 2290, 2342 ] }
2,341
AkoinToken
AkoinToken.sol
0x514e3d7c6b9b831903a93916b31e06ad2037b619
Solidity
StandardToken
contract StandardToken is ERC20, BasicToken { mapping (address => mapping (address => uint256)) internal allowed; /** * @dev Transfer tokens from one address to another * @param _from address The address which you want to send tokens from * @param _to address The address which you want to transfer to * @param _value uint256 the amount of tokens to be transferred */ function transferFrom( address _from, address _to, uint256 _value ) public returns (bool) { require(_to != address(0)); require(_value <= balances[_from]); require(_value <= allowed[_from][msg.sender]); balances[_from] = balances[_from].sub(_value); balances[_to] = balances[_to].add(_value); allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value); emit Transfer(_from, _to, _value); return true; } /** * @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender. * * Beware that changing an allowance with this method brings the risk that someone may use both the old * and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this * race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * @param _spender The address which will spend the funds. * @param _value The amount of tokens to be spent. */ function approve(address _spender, uint256 _value) public returns (bool) { allowed[msg.sender][_spender] = _value; emit Approval(msg.sender, _spender, _value); return true; } /** * @dev Function to check the amount of tokens that an owner allowed to a spender. * @param _owner address The address which owns the funds. * @param _spender address The address which will spend the funds. * @return A uint256 specifying the amount of tokens still available for the spender. */ function allowance( address _owner, address _spender ) public view returns (uint256) { return allowed[_owner][_spender]; } /** * @dev Function to revert eth transfers to this contract */ function() public payable { revert(); } /** * @dev Owner can transfer out any accidentally sent ERC20 tokens */ function transferAnyERC20Token(address tokenAddress, uint tokens) public onlyOwner returns (bool success) { return BasicToken(tokenAddress).transfer(owner, tokens); } }
/** * @title Standard ERC20 token * * @dev Implementation of the basic standard token. * @dev https://github.com/ethereum/EIPs/issues/20 * @dev Based on code by FirstBlood: https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol */
NatSpecMultiLine
transferAnyERC20Token
function transferAnyERC20Token(address tokenAddress, uint tokens) public onlyOwner returns (bool success) { return BasicToken(tokenAddress).transfer(owner, tokens); }
/** * @dev Owner can transfer out any accidentally sent ERC20 tokens */
NatSpecMultiLine
v0.4.23+commit.124ca40d
bzzr://cc26b86a6bcd38b51ac4751ab4b9133535cabb1b8d0f44892199a93cfad754c6
{ "func_code_index": [ 2434, 2616 ] }
2,342
AkoinToken
AkoinToken.sol
0x514e3d7c6b9b831903a93916b31e06ad2037b619
Solidity
PausableToken
contract PausableToken is StandardToken, Pausable { function transfer( address _to, uint256 _value ) public whenNotPaused returns (bool) { return super.transfer(_to, _value); } function transferFrom( address _from, address _to, uint256 _value ) public whenNotPaused returns (bool) { return super.transferFrom(_from, _to, _value); } function approve( address _spender, uint256 _value ) public whenNotPaused returns (bool) { return super.approve(_spender, _value); } /** * @dev Transfer the specified amounts of tokens to the specified addresses. * @dev Be aware that there is no check for duplicate recipients. * * @param _toAddresses Receiver addresses. * @param _amounts Amounts of tokens that will be transferred. */ function multiTransfer(address[] _toAddresses, uint256[] _amounts) public whenNotPaused returns (bool) { /* Ensures _toAddresses array is less than or equal to 255 */ require(_toAddresses.length <= 255); /* Ensures _toAddress and _amounts have the same number of entries. */ require(_toAddresses.length == _amounts.length); for (uint8 i = 0; i < _toAddresses.length; i++) { transfer(_toAddresses[i], _amounts[i]); } } /** * @dev Transfer the specified amounts of tokens to the specified addresses from authorized balance of sender. * @dev Be aware that there is no check for duplicate recipients. * * @param _from The address of the sender * @param _toAddresses The addresses of the recipients (MAX 255) * @param _amounts The amounts of tokens to be transferred */ function multiTransferFrom(address _from, address[] _toAddresses, uint256[] _amounts) public whenNotPaused returns (bool) { /* Ensures _toAddresses array is less than or equal to 255 */ require(_toAddresses.length <= 255); /* Ensures _toAddress and _amounts have the same number of entries. */ require(_toAddresses.length == _amounts.length); for (uint8 i = 0; i < _toAddresses.length; i++) { transferFrom(_from, _toAddresses[i], _amounts[i]); } } }
/** * @title Pausable token * @dev StandardToken modified with pausable transfers. **/
NatSpecMultiLine
multiTransfer
function multiTransfer(address[] _toAddresses, uint256[] _amounts) public whenNotPaused returns (bool) { /* Ensures _toAddresses array is less than or equal to 255 */ require(_toAddresses.length <= 255); /* Ensures _toAddress and _amounts have the same number of entries. */ require(_toAddresses.length == _amounts.length); for (uint8 i = 0; i < _toAddresses.length; i++) { transfer(_toAddresses[i], _amounts[i]); } }
/** * @dev Transfer the specified amounts of tokens to the specified addresses. * @dev Be aware that there is no check for duplicate recipients. * * @param _toAddresses Receiver addresses. * @param _amounts Amounts of tokens that will be transferred. */
NatSpecMultiLine
v0.4.23+commit.124ca40d
bzzr://cc26b86a6bcd38b51ac4751ab4b9133535cabb1b8d0f44892199a93cfad754c6
{ "func_code_index": [ 897, 1393 ] }
2,343
AkoinToken
AkoinToken.sol
0x514e3d7c6b9b831903a93916b31e06ad2037b619
Solidity
PausableToken
contract PausableToken is StandardToken, Pausable { function transfer( address _to, uint256 _value ) public whenNotPaused returns (bool) { return super.transfer(_to, _value); } function transferFrom( address _from, address _to, uint256 _value ) public whenNotPaused returns (bool) { return super.transferFrom(_from, _to, _value); } function approve( address _spender, uint256 _value ) public whenNotPaused returns (bool) { return super.approve(_spender, _value); } /** * @dev Transfer the specified amounts of tokens to the specified addresses. * @dev Be aware that there is no check for duplicate recipients. * * @param _toAddresses Receiver addresses. * @param _amounts Amounts of tokens that will be transferred. */ function multiTransfer(address[] _toAddresses, uint256[] _amounts) public whenNotPaused returns (bool) { /* Ensures _toAddresses array is less than or equal to 255 */ require(_toAddresses.length <= 255); /* Ensures _toAddress and _amounts have the same number of entries. */ require(_toAddresses.length == _amounts.length); for (uint8 i = 0; i < _toAddresses.length; i++) { transfer(_toAddresses[i], _amounts[i]); } } /** * @dev Transfer the specified amounts of tokens to the specified addresses from authorized balance of sender. * @dev Be aware that there is no check for duplicate recipients. * * @param _from The address of the sender * @param _toAddresses The addresses of the recipients (MAX 255) * @param _amounts The amounts of tokens to be transferred */ function multiTransferFrom(address _from, address[] _toAddresses, uint256[] _amounts) public whenNotPaused returns (bool) { /* Ensures _toAddresses array is less than or equal to 255 */ require(_toAddresses.length <= 255); /* Ensures _toAddress and _amounts have the same number of entries. */ require(_toAddresses.length == _amounts.length); for (uint8 i = 0; i < _toAddresses.length; i++) { transferFrom(_from, _toAddresses[i], _amounts[i]); } } }
/** * @title Pausable token * @dev StandardToken modified with pausable transfers. **/
NatSpecMultiLine
multiTransferFrom
function multiTransferFrom(address _from, address[] _toAddresses, uint256[] _amounts) public whenNotPaused returns (bool) { /* Ensures _toAddresses array is less than or equal to 255 */ require(_toAddresses.length <= 255); /* Ensures _toAddress and _amounts have the same number of entries. */ require(_toAddresses.length == _amounts.length); for (uint8 i = 0; i < _toAddresses.length; i++) { transferFrom(_from, _toAddresses[i], _amounts[i]); } }
/** * @dev Transfer the specified amounts of tokens to the specified addresses from authorized balance of sender. * @dev Be aware that there is no check for duplicate recipients. * * @param _from The address of the sender * @param _toAddresses The addresses of the recipients (MAX 255) * @param _amounts The amounts of tokens to be transferred */
NatSpecMultiLine
v0.4.23+commit.124ca40d
bzzr://cc26b86a6bcd38b51ac4751ab4b9133535cabb1b8d0f44892199a93cfad754c6
{ "func_code_index": [ 1783, 2309 ] }
2,344
GlobalDigitalAssetsToken
GlobalDigitalAssetsToken.sol
0x23ff814b0914be0c2d53cd4929f98ef9407f500e
Solidity
SafeMath
library SafeMath { /** * @dev Multiplies two numbers, throws on overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256 c) { if (a == 0) { return 0; } c = a * b; assert(c / a == b); return c; } /** * @dev Integer division of two numbers, truncating the quotient. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { return a / b; } /** * @dev Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend). */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { assert(b <= a); return a - b; } /** * @dev Adds two numbers, throws on overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256 c) { c = a + b; assert(c >= a); return c; } }
mul
function mul(uint256 a, uint256 b) internal pure returns (uint256 c) { if (a == 0) { return 0; } c = a * b; assert(c / a == b); return c; }
/** * @dev Multiplies two numbers, throws on overflow. */
NatSpecMultiLine
v0.4.25+commit.59dbf8f1
bzzr://9baace7e5633931ff6e63f51439569b93bdcd8150d91173ff09b20c12dec0555
{ "func_code_index": [ 89, 270 ] }
2,345
GlobalDigitalAssetsToken
GlobalDigitalAssetsToken.sol
0x23ff814b0914be0c2d53cd4929f98ef9407f500e
Solidity
SafeMath
library SafeMath { /** * @dev Multiplies two numbers, throws on overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256 c) { if (a == 0) { return 0; } c = a * b; assert(c / a == b); return c; } /** * @dev Integer division of two numbers, truncating the quotient. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { return a / b; } /** * @dev Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend). */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { assert(b <= a); return a - b; } /** * @dev Adds two numbers, throws on overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256 c) { c = a + b; assert(c >= a); return c; } }
div
function div(uint256 a, uint256 b) internal pure returns (uint256) { return a / b; }
/** * @dev Integer division of two numbers, truncating the quotient. */
NatSpecMultiLine
v0.4.25+commit.59dbf8f1
bzzr://9baace7e5633931ff6e63f51439569b93bdcd8150d91173ff09b20c12dec0555
{ "func_code_index": [ 354, 451 ] }
2,346
GlobalDigitalAssetsToken
GlobalDigitalAssetsToken.sol
0x23ff814b0914be0c2d53cd4929f98ef9407f500e
Solidity
SafeMath
library SafeMath { /** * @dev Multiplies two numbers, throws on overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256 c) { if (a == 0) { return 0; } c = a * b; assert(c / a == b); return c; } /** * @dev Integer division of two numbers, truncating the quotient. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { return a / b; } /** * @dev Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend). */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { assert(b <= a); return a - b; } /** * @dev Adds two numbers, throws on overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256 c) { c = a + b; assert(c >= a); return c; } }
sub
function sub(uint256 a, uint256 b) internal pure returns (uint256) { assert(b <= a); return a - b; }
/** * @dev Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend). */
NatSpecMultiLine
v0.4.25+commit.59dbf8f1
bzzr://9baace7e5633931ff6e63f51439569b93bdcd8150d91173ff09b20c12dec0555
{ "func_code_index": [ 565, 681 ] }
2,347
GlobalDigitalAssetsToken
GlobalDigitalAssetsToken.sol
0x23ff814b0914be0c2d53cd4929f98ef9407f500e
Solidity
SafeMath
library SafeMath { /** * @dev Multiplies two numbers, throws on overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256 c) { if (a == 0) { return 0; } c = a * b; assert(c / a == b); return c; } /** * @dev Integer division of two numbers, truncating the quotient. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { return a / b; } /** * @dev Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend). */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { assert(b <= a); return a - b; } /** * @dev Adds two numbers, throws on overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256 c) { c = a + b; assert(c >= a); return c; } }
add
function add(uint256 a, uint256 b) internal pure returns (uint256 c) { c = a + b; assert(c >= a); return c; }
/** * @dev Adds two numbers, throws on overflow. */
NatSpecMultiLine
v0.4.25+commit.59dbf8f1
bzzr://9baace7e5633931ff6e63f51439569b93bdcd8150d91173ff09b20c12dec0555
{ "func_code_index": [ 745, 875 ] }
2,348
GlobalDigitalAssetsToken
GlobalDigitalAssetsToken.sol
0x23ff814b0914be0c2d53cd4929f98ef9407f500e
Solidity
StandardToken
contract StandardToken is ERC20, BasicToken { mapping (address => mapping (address => uint256)) internal allowed; /** * @dev 从一个地址向另外一个地址转token * @param _from 转账的from地址 * @param _to address 转账的to地址 * @param _value uint256 转账token数量 */ function transferFrom( address _from, address _to, uint256 _value ) public returns (bool) { // 做合法性检查 require(_to != address(0)); require(_value <= balances[_from]); require(_value <= allowed[_from][msg.sender]); balances[_from] = balances[_from].sub(_value); balances[_to] = balances[_to].add(_value); allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value); emit Transfer(_from, _to, _value); return true; } function approve(address _spender, uint256 _value) public returns (bool) { allowed[msg.sender][_spender] = _value; emit Approval(msg.sender, _spender, _value); return true; } function allowance( address _owner, address _spender ) public view returns (uint256) { return allowed[_owner][_spender]; } }
transferFrom
function transferFrom( address _from, address _to, uint256 _value ) public returns (bool) { // 做合法性检查 require(_to != address(0)); require(_value <= balances[_from]); require(_value <= allowed[_from][msg.sender]); balances[_from] = balances[_from].sub(_value); balances[_to] = balances[_to].add(_value); allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value); emit Transfer(_from, _to, _value); return true; }
/** * @dev 从一个地址向另外一个地址转token * @param _from 转账的from地址 * @param _to address 转账的to地址 * @param _value uint256 转账token数量 */
NatSpecMultiLine
v0.4.25+commit.59dbf8f1
bzzr://9baace7e5633931ff6e63f51439569b93bdcd8150d91173ff09b20c12dec0555
{ "func_code_index": [ 264, 767 ] }
2,349
GlobalDigitalAssetsToken
GlobalDigitalAssetsToken.sol
0x23ff814b0914be0c2d53cd4929f98ef9407f500e
Solidity
BurnableToken
contract BurnableToken is BasicToken { event Burn(address indexed burner, uint256 value); /** * @dev 销毁指定数量的token. * @param _value 被销毁的token数量. */ function burn(uint256 _value) public { _burn(msg.sender, _value); } function _burn(address _who, uint256 _value) internal { require(_value <= balances[_who]); balances[_who] = balances[_who].sub(_value); totalSupply_ = totalSupply_.sub(_value); emit Burn(_who, _value); emit Transfer(_who, address(0), _value); } }
/** * @title 可销毁 Token * @dev Token被地销毁 */
NatSpecMultiLine
burn
function burn(uint256 _value) public { _burn(msg.sender, _value); }
/** * @dev 销毁指定数量的token. * @param _value 被销毁的token数量. */
NatSpecMultiLine
v0.4.25+commit.59dbf8f1
bzzr://9baace7e5633931ff6e63f51439569b93bdcd8150d91173ff09b20c12dec0555
{ "func_code_index": [ 170, 248 ] }
2,350
GlobalDigitalAssetsToken
GlobalDigitalAssetsToken.sol
0x23ff814b0914be0c2d53cd4929f98ef9407f500e
Solidity
MintableToken
contract MintableToken is StandardToken { event Mint(address indexed to, uint256 amount); event MintFinished(); bool public mintingFinished = false; modifier canMint() { require(!mintingFinished); _; } /** * @dev Function to mint tokens * @param _to The address that will receive the minted tokens. * @param _amount The amount of tokens to mint. * @return A boolean that indicates if the operation was successful. */ function mint( address _to, uint256 _amount ) public canMint returns (bool) { totalSupply_ = totalSupply_.add(_amount); balances[_to] = balances[_to].add(_amount); emit Mint(_to, _amount); emit Transfer(address(0), _to, _amount); return true; } /** * @dev Function to stop minting new tokens. * @return True if the operation was successful. */ function finishMinting() public canMint returns (bool) { mintingFinished = true; emit MintFinished(); return true; } }
mint
function mint( address _to, uint256 _amount ) public canMint returns (bool) { totalSupply_ = totalSupply_.add(_amount); balances[_to] = balances[_to].add(_amount); emit Mint(_to, _amount); emit Transfer(address(0), _to, _amount); return true; }
/** * @dev Function to mint tokens * @param _to The address that will receive the minted tokens. * @param _amount The amount of tokens to mint. * @return A boolean that indicates if the operation was successful. */
NatSpecMultiLine
v0.4.25+commit.59dbf8f1
bzzr://9baace7e5633931ff6e63f51439569b93bdcd8150d91173ff09b20c12dec0555
{ "func_code_index": [ 474, 780 ] }
2,351
GlobalDigitalAssetsToken
GlobalDigitalAssetsToken.sol
0x23ff814b0914be0c2d53cd4929f98ef9407f500e
Solidity
MintableToken
contract MintableToken is StandardToken { event Mint(address indexed to, uint256 amount); event MintFinished(); bool public mintingFinished = false; modifier canMint() { require(!mintingFinished); _; } /** * @dev Function to mint tokens * @param _to The address that will receive the minted tokens. * @param _amount The amount of tokens to mint. * @return A boolean that indicates if the operation was successful. */ function mint( address _to, uint256 _amount ) public canMint returns (bool) { totalSupply_ = totalSupply_.add(_amount); balances[_to] = balances[_to].add(_amount); emit Mint(_to, _amount); emit Transfer(address(0), _to, _amount); return true; } /** * @dev Function to stop minting new tokens. * @return True if the operation was successful. */ function finishMinting() public canMint returns (bool) { mintingFinished = true; emit MintFinished(); return true; } }
finishMinting
function finishMinting() public canMint returns (bool) { mintingFinished = true; emit MintFinished(); return true; }
/** * @dev Function to stop minting new tokens. * @return True if the operation was successful. */
NatSpecMultiLine
v0.4.25+commit.59dbf8f1
bzzr://9baace7e5633931ff6e63f51439569b93bdcd8150d91173ff09b20c12dec0555
{ "func_code_index": [ 897, 1035 ] }
2,352
GlobalDigitalAssetsToken
GlobalDigitalAssetsToken.sol
0x23ff814b0914be0c2d53cd4929f98ef9407f500e
Solidity
StandardBurnableToken
contract StandardBurnableToken is BurnableToken, StandardToken,MintableToken { /** * @dev 从目标地址销毁特定数量的token并减少允许量 * @param _from address token所有者地址 * @param _value uint256 被销毁的token数量 */ function burnFrom(address _from, uint256 _value) public { require(_value <= allowed[_from][msg.sender]); allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value); _burn(_from, _value); } }
/** * @title 标准可销毁token * @dev 将burnFrom方法添加到ERC20实现中 */
NatSpecMultiLine
burnFrom
function burnFrom(address _from, uint256 _value) public { require(_value <= allowed[_from][msg.sender]); allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value); _burn(_from, _value); }
/** * @dev 从目标地址销毁特定数量的token并减少允许量 * @param _from address token所有者地址 * @param _value uint256 被销毁的token数量 */
NatSpecMultiLine
v0.4.25+commit.59dbf8f1
bzzr://9baace7e5633931ff6e63f51439569b93bdcd8150d91173ff09b20c12dec0555
{ "func_code_index": [ 209, 427 ] }
2,353
FooToken
FooToken.sol
0x415a9fd755a63cafddfcd35f95e169f2879559c9
Solidity
Ownable
contract Ownable { address public owner; event OwnershipRenounced(address indexed previousOwner); event OwnershipTransferred( address indexed previousOwner, address indexed newOwner ); /** * @dev The Ownable constructor sets the original `owner` of the contract to the sender * account. */ constructor() public { owner = msg.sender; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(msg.sender == 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)); emit OwnershipTransferred(owner, _newOwner); owner = _newOwner; } }
/** * @title Ownable * @dev The Ownable contract has an owner address, and provides basic authorization control * functions, this simplifies the implementation of "user permissions". */
NatSpecMultiLine
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.4.24+commit.e67f0147
bzzr://99f1cc6586a4044c761ad50c56ee8509a948ad9a6fc3b8884817dde67b6fe823
{ "func_code_index": [ 815, 932 ] }
2,354
FooToken
FooToken.sol
0x415a9fd755a63cafddfcd35f95e169f2879559c9
Solidity
Ownable
contract Ownable { address public owner; event OwnershipRenounced(address indexed previousOwner); event OwnershipTransferred( address indexed previousOwner, address indexed newOwner ); /** * @dev The Ownable constructor sets the original `owner` of the contract to the sender * account. */ constructor() public { owner = msg.sender; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(msg.sender == 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)); emit OwnershipTransferred(owner, _newOwner); owner = _newOwner; } }
/** * @title Ownable * @dev The Ownable contract has an owner address, and provides basic authorization control * functions, this simplifies the implementation of "user permissions". */
NatSpecMultiLine
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.4.24+commit.e67f0147
bzzr://99f1cc6586a4044c761ad50c56ee8509a948ad9a6fc3b8884817dde67b6fe823
{ "func_code_index": [ 1097, 1205 ] }
2,355
FooToken
FooToken.sol
0x415a9fd755a63cafddfcd35f95e169f2879559c9
Solidity
Ownable
contract Ownable { address public owner; event OwnershipRenounced(address indexed previousOwner); event OwnershipTransferred( address indexed previousOwner, address indexed newOwner ); /** * @dev The Ownable constructor sets the original `owner` of the contract to the sender * account. */ constructor() public { owner = msg.sender; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(msg.sender == 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)); emit OwnershipTransferred(owner, _newOwner); owner = _newOwner; } }
/** * @title Ownable * @dev The Ownable contract has an owner address, and provides basic authorization control * functions, this simplifies the implementation of "user permissions". */
NatSpecMultiLine
_transferOwnership
function _transferOwnership(address _newOwner) internal { require(_newOwner != address(0)); 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.4.24+commit.e67f0147
bzzr://99f1cc6586a4044c761ad50c56ee8509a948ad9a6fc3b8884817dde67b6fe823
{ "func_code_index": [ 1343, 1521 ] }
2,356
FooToken
FooToken.sol
0x415a9fd755a63cafddfcd35f95e169f2879559c9
Solidity
SafeMath
library SafeMath { /** * @dev Multiplies two numbers, throws on overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256 c) { // Gas optimization: this is cheaper than asserting 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522 if (a == 0) { return 0; } c = a * b; assert(c / a == b); return c; } /** * @dev Integer division of two numbers, truncating the quotient. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { // assert(b > 0); // Solidity automatically throws when dividing by 0 // uint256 c = a / b; // assert(a == b * c + a % b); // There is no case in which this doesn't hold return a / b; } /** * @dev Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend). */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { assert(b <= a); return a - b; } /** * @dev Adds two numbers, throws on overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256 c) { c = a + b; assert(c >= a); return c; } }
/** * @title SafeMath * @dev Math operations with safety checks that throw on error */
NatSpecMultiLine
mul
function mul(uint256 a, uint256 b) internal pure returns (uint256 c) { // Gas optimization: this is cheaper than asserting 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522 if (a == 0) { return 0; } c = a * b; assert(c / a == b); return c; }
/** * @dev Multiplies two numbers, throws on overflow. */
NatSpecMultiLine
v0.4.24+commit.e67f0147
bzzr://99f1cc6586a4044c761ad50c56ee8509a948ad9a6fc3b8884817dde67b6fe823
{ "func_code_index": [ 89, 476 ] }
2,357
FooToken
FooToken.sol
0x415a9fd755a63cafddfcd35f95e169f2879559c9
Solidity
SafeMath
library SafeMath { /** * @dev Multiplies two numbers, throws on overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256 c) { // Gas optimization: this is cheaper than asserting 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522 if (a == 0) { return 0; } c = a * b; assert(c / a == b); return c; } /** * @dev Integer division of two numbers, truncating the quotient. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { // assert(b > 0); // Solidity automatically throws when dividing by 0 // uint256 c = a / b; // assert(a == b * c + a % b); // There is no case in which this doesn't hold return a / b; } /** * @dev Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend). */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { assert(b <= a); return a - b; } /** * @dev Adds two numbers, throws on overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256 c) { c = a + b; assert(c >= a); return c; } }
/** * @title SafeMath * @dev Math operations with safety checks that throw on error */
NatSpecMultiLine
div
function div(uint256 a, uint256 b) internal pure returns (uint256) { // assert(b > 0); // Solidity automatically throws when dividing by 0 // uint256 c = a / b; // assert(a == b * c + a % b); // There is no case in which this doesn't hold return a / b; }
/** * @dev Integer division of two numbers, truncating the quotient. */
NatSpecMultiLine
v0.4.24+commit.e67f0147
bzzr://99f1cc6586a4044c761ad50c56ee8509a948ad9a6fc3b8884817dde67b6fe823
{ "func_code_index": [ 560, 840 ] }
2,358
FooToken
FooToken.sol
0x415a9fd755a63cafddfcd35f95e169f2879559c9
Solidity
SafeMath
library SafeMath { /** * @dev Multiplies two numbers, throws on overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256 c) { // Gas optimization: this is cheaper than asserting 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522 if (a == 0) { return 0; } c = a * b; assert(c / a == b); return c; } /** * @dev Integer division of two numbers, truncating the quotient. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { // assert(b > 0); // Solidity automatically throws when dividing by 0 // uint256 c = a / b; // assert(a == b * c + a % b); // There is no case in which this doesn't hold return a / b; } /** * @dev Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend). */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { assert(b <= a); return a - b; } /** * @dev Adds two numbers, throws on overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256 c) { c = a + b; assert(c >= a); return c; } }
/** * @title SafeMath * @dev Math operations with safety checks that throw on error */
NatSpecMultiLine
sub
function sub(uint256 a, uint256 b) internal pure returns (uint256) { assert(b <= a); return a - b; }
/** * @dev Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend). */
NatSpecMultiLine
v0.4.24+commit.e67f0147
bzzr://99f1cc6586a4044c761ad50c56ee8509a948ad9a6fc3b8884817dde67b6fe823
{ "func_code_index": [ 954, 1070 ] }
2,359
FooToken
FooToken.sol
0x415a9fd755a63cafddfcd35f95e169f2879559c9
Solidity
SafeMath
library SafeMath { /** * @dev Multiplies two numbers, throws on overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256 c) { // Gas optimization: this is cheaper than asserting 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522 if (a == 0) { return 0; } c = a * b; assert(c / a == b); return c; } /** * @dev Integer division of two numbers, truncating the quotient. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { // assert(b > 0); // Solidity automatically throws when dividing by 0 // uint256 c = a / b; // assert(a == b * c + a % b); // There is no case in which this doesn't hold return a / b; } /** * @dev Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend). */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { assert(b <= a); return a - b; } /** * @dev Adds two numbers, throws on overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256 c) { c = a + b; assert(c >= a); return c; } }
/** * @title SafeMath * @dev Math operations with safety checks that throw on error */
NatSpecMultiLine
add
function add(uint256 a, uint256 b) internal pure returns (uint256 c) { c = a + b; assert(c >= a); return c; }
/** * @dev Adds two numbers, throws on overflow. */
NatSpecMultiLine
v0.4.24+commit.e67f0147
bzzr://99f1cc6586a4044c761ad50c56ee8509a948ad9a6fc3b8884817dde67b6fe823
{ "func_code_index": [ 1134, 1264 ] }
2,360
FooToken
FooToken.sol
0x415a9fd755a63cafddfcd35f95e169f2879559c9
Solidity
BasicToken
contract BasicToken is ERC20Basic { using SafeMath for uint256; mapping(address => uint256) balances; uint256 totalSupply_; /** * @dev Total number of tokens in existence */ function totalSupply() public view returns (uint256) { return totalSupply_; } /** * @dev Transfer token for a specified address * @param _to The address to transfer to. * @param _value The amount to be transferred. */ function transfer(address _to, uint256 _value) public returns (bool) { require(_to != address(0)); require(_value <= balances[msg.sender]); balances[msg.sender] = balances[msg.sender].sub(_value); balances[_to] = balances[_to].add(_value); emit Transfer(msg.sender, _to, _value); return true; } /** * @dev Gets the balance of the specified address. * @param _owner The address to query the the balance of. * @return An uint256 representing the amount owned by the passed address. */ function balanceOf(address _owner) public view returns (uint256) { return balances[_owner]; } }
/** * @title Basic token * @dev Basic version of StandardToken, with no allowances. */
NatSpecMultiLine
totalSupply
function totalSupply() public view returns (uint256) { return totalSupply_; }
/** * @dev Total number of tokens in existence */
NatSpecMultiLine
v0.4.24+commit.e67f0147
bzzr://99f1cc6586a4044c761ad50c56ee8509a948ad9a6fc3b8884817dde67b6fe823
{ "func_code_index": [ 199, 287 ] }
2,361
FooToken
FooToken.sol
0x415a9fd755a63cafddfcd35f95e169f2879559c9
Solidity
BasicToken
contract BasicToken is ERC20Basic { using SafeMath for uint256; mapping(address => uint256) balances; uint256 totalSupply_; /** * @dev Total number of tokens in existence */ function totalSupply() public view returns (uint256) { return totalSupply_; } /** * @dev Transfer token for a specified address * @param _to The address to transfer to. * @param _value The amount to be transferred. */ function transfer(address _to, uint256 _value) public returns (bool) { require(_to != address(0)); require(_value <= balances[msg.sender]); balances[msg.sender] = balances[msg.sender].sub(_value); balances[_to] = balances[_to].add(_value); emit Transfer(msg.sender, _to, _value); return true; } /** * @dev Gets the balance of the specified address. * @param _owner The address to query the the balance of. * @return An uint256 representing the amount owned by the passed address. */ function balanceOf(address _owner) public view returns (uint256) { return balances[_owner]; } }
/** * @title Basic token * @dev Basic version of StandardToken, with no allowances. */
NatSpecMultiLine
transfer
function transfer(address _to, uint256 _value) public returns (bool) { require(_to != address(0)); require(_value <= balances[msg.sender]); balances[msg.sender] = balances[msg.sender].sub(_value); balances[_to] = balances[_to].add(_value); emit Transfer(msg.sender, _to, _value); return true; }
/** * @dev Transfer token for a specified address * @param _to The address to transfer to. * @param _value The amount to be transferred. */
NatSpecMultiLine
v0.4.24+commit.e67f0147
bzzr://99f1cc6586a4044c761ad50c56ee8509a948ad9a6fc3b8884817dde67b6fe823
{ "func_code_index": [ 445, 777 ] }
2,362
FooToken
FooToken.sol
0x415a9fd755a63cafddfcd35f95e169f2879559c9
Solidity
BasicToken
contract BasicToken is ERC20Basic { using SafeMath for uint256; mapping(address => uint256) balances; uint256 totalSupply_; /** * @dev Total number of tokens in existence */ function totalSupply() public view returns (uint256) { return totalSupply_; } /** * @dev Transfer token for a specified address * @param _to The address to transfer to. * @param _value The amount to be transferred. */ function transfer(address _to, uint256 _value) public returns (bool) { require(_to != address(0)); require(_value <= balances[msg.sender]); balances[msg.sender] = balances[msg.sender].sub(_value); balances[_to] = balances[_to].add(_value); emit Transfer(msg.sender, _to, _value); return true; } /** * @dev Gets the balance of the specified address. * @param _owner The address to query the the balance of. * @return An uint256 representing the amount owned by the passed address. */ function balanceOf(address _owner) public view returns (uint256) { return balances[_owner]; } }
/** * @title Basic token * @dev Basic version of StandardToken, with no allowances. */
NatSpecMultiLine
balanceOf
function balanceOf(address _owner) public view returns (uint256) { return balances[_owner]; }
/** * @dev Gets the balance of the specified address. * @param _owner The address to query the the balance of. * @return An uint256 representing the amount owned by the passed address. */
NatSpecMultiLine
v0.4.24+commit.e67f0147
bzzr://99f1cc6586a4044c761ad50c56ee8509a948ad9a6fc3b8884817dde67b6fe823
{ "func_code_index": [ 983, 1087 ] }
2,363
FooToken
FooToken.sol
0x415a9fd755a63cafddfcd35f95e169f2879559c9
Solidity
StandardToken
contract StandardToken is ERC20, BasicToken { mapping (address => mapping (address => uint256)) internal allowed; /** * @dev Transfer tokens from one address to another * @param _from address The address which you want to send tokens from * @param _to address The address which you want to transfer to * @param _value uint256 the amount of tokens to be transferred */ function transferFrom( address _from, address _to, uint256 _value ) public returns (bool) { require(_to != address(0)); require(_value <= balances[_from]); require(_value <= allowed[_from][msg.sender]); balances[_from] = balances[_from].sub(_value); balances[_to] = balances[_to].add(_value); allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value); emit Transfer(_from, _to, _value); return true; } /** * @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender. * * Beware that changing an allowance with this method brings the risk that someone may use both the old * and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this * race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * @param _spender The address which will spend the funds. * @param _value The amount of tokens to be spent. */ function approve(address _spender, uint256 _value) public returns (bool) { allowed[msg.sender][_spender] = _value; emit Approval(msg.sender, _spender, _value); return true; } /** * @dev Function to check the amount of tokens that an owner allowed to a spender. * @param _owner address The address which owns the funds. * @param _spender address The address which will spend the funds. * @return A uint256 specifying the amount of tokens still available for the spender. */ function allowance( address _owner, address _spender ) public view returns (uint256) { return allowed[_owner][_spender]; } /** * @dev Increase the amount of tokens that an owner allowed to a spender. * * approve should be called when allowed[_spender] == 0. To increment * allowed value is better to use this function to avoid 2 calls (and wait until * the first transaction is mined) * From MonolithDAO Token.sol * @param _spender The address which will spend the funds. * @param _addedValue The amount of tokens to increase the allowance by. */ function increaseApproval( address _spender, uint256 _addedValue ) public returns (bool) { allowed[msg.sender][_spender] = ( allowed[msg.sender][_spender].add(_addedValue)); emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]); return true; } /** * @dev Decrease the amount of tokens that an owner allowed to a spender. * * approve should be called when allowed[_spender] == 0. To decrement * allowed value is better to use this function to avoid 2 calls (and wait until * the first transaction is mined) * From MonolithDAO Token.sol * @param _spender The address which will spend the funds. * @param _subtractedValue The amount of tokens to decrease the allowance by. */ function decreaseApproval( address _spender, uint256 _subtractedValue ) public returns (bool) { uint256 oldValue = allowed[msg.sender][_spender]; if (_subtractedValue > oldValue) { allowed[msg.sender][_spender] = 0; } else { allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue); } emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]); return true; } }
/** * @title Standard ERC20 token * * @dev Implementation of the basic standard token. * @dev https://github.com/ethereum/EIPs/issues/20 * @dev Based on code by FirstBlood: https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol */
NatSpecMultiLine
transferFrom
function transferFrom( address _from, address _to, uint256 _value ) public returns (bool) { require(_to != address(0)); require(_value <= balances[_from]); require(_value <= allowed[_from][msg.sender]); balances[_from] = balances[_from].sub(_value); balances[_to] = balances[_to].add(_value); allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value); emit Transfer(_from, _to, _value); return true; }
/** * @dev Transfer tokens from one address to another * @param _from address The address which you want to send tokens from * @param _to address The address which you want to transfer to * @param _value uint256 the amount of tokens to be transferred */
NatSpecMultiLine
v0.4.24+commit.e67f0147
bzzr://99f1cc6586a4044c761ad50c56ee8509a948ad9a6fc3b8884817dde67b6fe823
{ "func_code_index": [ 401, 891 ] }
2,364
FooToken
FooToken.sol
0x415a9fd755a63cafddfcd35f95e169f2879559c9
Solidity
StandardToken
contract StandardToken is ERC20, BasicToken { mapping (address => mapping (address => uint256)) internal allowed; /** * @dev Transfer tokens from one address to another * @param _from address The address which you want to send tokens from * @param _to address The address which you want to transfer to * @param _value uint256 the amount of tokens to be transferred */ function transferFrom( address _from, address _to, uint256 _value ) public returns (bool) { require(_to != address(0)); require(_value <= balances[_from]); require(_value <= allowed[_from][msg.sender]); balances[_from] = balances[_from].sub(_value); balances[_to] = balances[_to].add(_value); allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value); emit Transfer(_from, _to, _value); return true; } /** * @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender. * * Beware that changing an allowance with this method brings the risk that someone may use both the old * and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this * race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * @param _spender The address which will spend the funds. * @param _value The amount of tokens to be spent. */ function approve(address _spender, uint256 _value) public returns (bool) { allowed[msg.sender][_spender] = _value; emit Approval(msg.sender, _spender, _value); return true; } /** * @dev Function to check the amount of tokens that an owner allowed to a spender. * @param _owner address The address which owns the funds. * @param _spender address The address which will spend the funds. * @return A uint256 specifying the amount of tokens still available for the spender. */ function allowance( address _owner, address _spender ) public view returns (uint256) { return allowed[_owner][_spender]; } /** * @dev Increase the amount of tokens that an owner allowed to a spender. * * approve should be called when allowed[_spender] == 0. To increment * allowed value is better to use this function to avoid 2 calls (and wait until * the first transaction is mined) * From MonolithDAO Token.sol * @param _spender The address which will spend the funds. * @param _addedValue The amount of tokens to increase the allowance by. */ function increaseApproval( address _spender, uint256 _addedValue ) public returns (bool) { allowed[msg.sender][_spender] = ( allowed[msg.sender][_spender].add(_addedValue)); emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]); return true; } /** * @dev Decrease the amount of tokens that an owner allowed to a spender. * * approve should be called when allowed[_spender] == 0. To decrement * allowed value is better to use this function to avoid 2 calls (and wait until * the first transaction is mined) * From MonolithDAO Token.sol * @param _spender The address which will spend the funds. * @param _subtractedValue The amount of tokens to decrease the allowance by. */ function decreaseApproval( address _spender, uint256 _subtractedValue ) public returns (bool) { uint256 oldValue = allowed[msg.sender][_spender]; if (_subtractedValue > oldValue) { allowed[msg.sender][_spender] = 0; } else { allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue); } emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]); return true; } }
/** * @title Standard ERC20 token * * @dev Implementation of the basic standard token. * @dev https://github.com/ethereum/EIPs/issues/20 * @dev Based on code by FirstBlood: https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol */
NatSpecMultiLine
approve
function approve(address _spender, uint256 _value) public returns (bool) { allowed[msg.sender][_spender] = _value; emit Approval(msg.sender, _spender, _value); return true; }
/** * @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender. * * Beware that changing an allowance with this method brings the risk that someone may use both the old * and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this * race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * @param _spender The address which will spend the funds. * @param _value The amount of tokens to be spent. */
NatSpecMultiLine
v0.4.24+commit.e67f0147
bzzr://99f1cc6586a4044c761ad50c56ee8509a948ad9a6fc3b8884817dde67b6fe823
{ "func_code_index": [ 1523, 1718 ] }
2,365
FooToken
FooToken.sol
0x415a9fd755a63cafddfcd35f95e169f2879559c9
Solidity
StandardToken
contract StandardToken is ERC20, BasicToken { mapping (address => mapping (address => uint256)) internal allowed; /** * @dev Transfer tokens from one address to another * @param _from address The address which you want to send tokens from * @param _to address The address which you want to transfer to * @param _value uint256 the amount of tokens to be transferred */ function transferFrom( address _from, address _to, uint256 _value ) public returns (bool) { require(_to != address(0)); require(_value <= balances[_from]); require(_value <= allowed[_from][msg.sender]); balances[_from] = balances[_from].sub(_value); balances[_to] = balances[_to].add(_value); allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value); emit Transfer(_from, _to, _value); return true; } /** * @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender. * * Beware that changing an allowance with this method brings the risk that someone may use both the old * and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this * race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * @param _spender The address which will spend the funds. * @param _value The amount of tokens to be spent. */ function approve(address _spender, uint256 _value) public returns (bool) { allowed[msg.sender][_spender] = _value; emit Approval(msg.sender, _spender, _value); return true; } /** * @dev Function to check the amount of tokens that an owner allowed to a spender. * @param _owner address The address which owns the funds. * @param _spender address The address which will spend the funds. * @return A uint256 specifying the amount of tokens still available for the spender. */ function allowance( address _owner, address _spender ) public view returns (uint256) { return allowed[_owner][_spender]; } /** * @dev Increase the amount of tokens that an owner allowed to a spender. * * approve should be called when allowed[_spender] == 0. To increment * allowed value is better to use this function to avoid 2 calls (and wait until * the first transaction is mined) * From MonolithDAO Token.sol * @param _spender The address which will spend the funds. * @param _addedValue The amount of tokens to increase the allowance by. */ function increaseApproval( address _spender, uint256 _addedValue ) public returns (bool) { allowed[msg.sender][_spender] = ( allowed[msg.sender][_spender].add(_addedValue)); emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]); return true; } /** * @dev Decrease the amount of tokens that an owner allowed to a spender. * * approve should be called when allowed[_spender] == 0. To decrement * allowed value is better to use this function to avoid 2 calls (and wait until * the first transaction is mined) * From MonolithDAO Token.sol * @param _spender The address which will spend the funds. * @param _subtractedValue The amount of tokens to decrease the allowance by. */ function decreaseApproval( address _spender, uint256 _subtractedValue ) public returns (bool) { uint256 oldValue = allowed[msg.sender][_spender]; if (_subtractedValue > oldValue) { allowed[msg.sender][_spender] = 0; } else { allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue); } emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]); return true; } }
/** * @title Standard ERC20 token * * @dev Implementation of the basic standard token. * @dev https://github.com/ethereum/EIPs/issues/20 * @dev Based on code by FirstBlood: https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol */
NatSpecMultiLine
allowance
function allowance( address _owner, address _spender ) public view returns (uint256) { return allowed[_owner][_spender]; }
/** * @dev Function to check the amount of tokens that an owner allowed to a spender. * @param _owner address The address which owns the funds. * @param _spender address The address which will spend the funds. * @return A uint256 specifying the amount of tokens still available for the spender. */
NatSpecMultiLine
v0.4.24+commit.e67f0147
bzzr://99f1cc6586a4044c761ad50c56ee8509a948ad9a6fc3b8884817dde67b6fe823
{ "func_code_index": [ 2042, 2207 ] }
2,366
FooToken
FooToken.sol
0x415a9fd755a63cafddfcd35f95e169f2879559c9
Solidity
StandardToken
contract StandardToken is ERC20, BasicToken { mapping (address => mapping (address => uint256)) internal allowed; /** * @dev Transfer tokens from one address to another * @param _from address The address which you want to send tokens from * @param _to address The address which you want to transfer to * @param _value uint256 the amount of tokens to be transferred */ function transferFrom( address _from, address _to, uint256 _value ) public returns (bool) { require(_to != address(0)); require(_value <= balances[_from]); require(_value <= allowed[_from][msg.sender]); balances[_from] = balances[_from].sub(_value); balances[_to] = balances[_to].add(_value); allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value); emit Transfer(_from, _to, _value); return true; } /** * @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender. * * Beware that changing an allowance with this method brings the risk that someone may use both the old * and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this * race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * @param _spender The address which will spend the funds. * @param _value The amount of tokens to be spent. */ function approve(address _spender, uint256 _value) public returns (bool) { allowed[msg.sender][_spender] = _value; emit Approval(msg.sender, _spender, _value); return true; } /** * @dev Function to check the amount of tokens that an owner allowed to a spender. * @param _owner address The address which owns the funds. * @param _spender address The address which will spend the funds. * @return A uint256 specifying the amount of tokens still available for the spender. */ function allowance( address _owner, address _spender ) public view returns (uint256) { return allowed[_owner][_spender]; } /** * @dev Increase the amount of tokens that an owner allowed to a spender. * * approve should be called when allowed[_spender] == 0. To increment * allowed value is better to use this function to avoid 2 calls (and wait until * the first transaction is mined) * From MonolithDAO Token.sol * @param _spender The address which will spend the funds. * @param _addedValue The amount of tokens to increase the allowance by. */ function increaseApproval( address _spender, uint256 _addedValue ) public returns (bool) { allowed[msg.sender][_spender] = ( allowed[msg.sender][_spender].add(_addedValue)); emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]); return true; } /** * @dev Decrease the amount of tokens that an owner allowed to a spender. * * approve should be called when allowed[_spender] == 0. To decrement * allowed value is better to use this function to avoid 2 calls (and wait until * the first transaction is mined) * From MonolithDAO Token.sol * @param _spender The address which will spend the funds. * @param _subtractedValue The amount of tokens to decrease the allowance by. */ function decreaseApproval( address _spender, uint256 _subtractedValue ) public returns (bool) { uint256 oldValue = allowed[msg.sender][_spender]; if (_subtractedValue > oldValue) { allowed[msg.sender][_spender] = 0; } else { allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue); } emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]); return true; } }
/** * @title Standard ERC20 token * * @dev Implementation of the basic standard token. * @dev https://github.com/ethereum/EIPs/issues/20 * @dev Based on code by FirstBlood: https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol */
NatSpecMultiLine
increaseApproval
function increaseApproval( address _spender, uint256 _addedValue ) public returns (bool) { allowed[msg.sender][_spender] = ( allowed[msg.sender][_spender].add(_addedValue)); emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]); return true; }
/** * @dev Increase the amount of tokens that an owner allowed to a spender. * * approve should be called when allowed[_spender] == 0. To increment * allowed value is better to use this function to avoid 2 calls (and wait until * the first transaction is mined) * From MonolithDAO Token.sol * @param _spender The address which will spend the funds. * @param _addedValue The amount of tokens to increase the allowance by. */
NatSpecMultiLine
v0.4.24+commit.e67f0147
bzzr://99f1cc6586a4044c761ad50c56ee8509a948ad9a6fc3b8884817dde67b6fe823
{ "func_code_index": [ 2673, 2983 ] }
2,367
FooToken
FooToken.sol
0x415a9fd755a63cafddfcd35f95e169f2879559c9
Solidity
StandardToken
contract StandardToken is ERC20, BasicToken { mapping (address => mapping (address => uint256)) internal allowed; /** * @dev Transfer tokens from one address to another * @param _from address The address which you want to send tokens from * @param _to address The address which you want to transfer to * @param _value uint256 the amount of tokens to be transferred */ function transferFrom( address _from, address _to, uint256 _value ) public returns (bool) { require(_to != address(0)); require(_value <= balances[_from]); require(_value <= allowed[_from][msg.sender]); balances[_from] = balances[_from].sub(_value); balances[_to] = balances[_to].add(_value); allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value); emit Transfer(_from, _to, _value); return true; } /** * @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender. * * Beware that changing an allowance with this method brings the risk that someone may use both the old * and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this * race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * @param _spender The address which will spend the funds. * @param _value The amount of tokens to be spent. */ function approve(address _spender, uint256 _value) public returns (bool) { allowed[msg.sender][_spender] = _value; emit Approval(msg.sender, _spender, _value); return true; } /** * @dev Function to check the amount of tokens that an owner allowed to a spender. * @param _owner address The address which owns the funds. * @param _spender address The address which will spend the funds. * @return A uint256 specifying the amount of tokens still available for the spender. */ function allowance( address _owner, address _spender ) public view returns (uint256) { return allowed[_owner][_spender]; } /** * @dev Increase the amount of tokens that an owner allowed to a spender. * * approve should be called when allowed[_spender] == 0. To increment * allowed value is better to use this function to avoid 2 calls (and wait until * the first transaction is mined) * From MonolithDAO Token.sol * @param _spender The address which will spend the funds. * @param _addedValue The amount of tokens to increase the allowance by. */ function increaseApproval( address _spender, uint256 _addedValue ) public returns (bool) { allowed[msg.sender][_spender] = ( allowed[msg.sender][_spender].add(_addedValue)); emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]); return true; } /** * @dev Decrease the amount of tokens that an owner allowed to a spender. * * approve should be called when allowed[_spender] == 0. To decrement * allowed value is better to use this function to avoid 2 calls (and wait until * the first transaction is mined) * From MonolithDAO Token.sol * @param _spender The address which will spend the funds. * @param _subtractedValue The amount of tokens to decrease the allowance by. */ function decreaseApproval( address _spender, uint256 _subtractedValue ) public returns (bool) { uint256 oldValue = allowed[msg.sender][_spender]; if (_subtractedValue > oldValue) { allowed[msg.sender][_spender] = 0; } else { allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue); } emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]); return true; } }
/** * @title Standard ERC20 token * * @dev Implementation of the basic standard token. * @dev https://github.com/ethereum/EIPs/issues/20 * @dev Based on code by FirstBlood: https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol */
NatSpecMultiLine
decreaseApproval
function decreaseApproval( address _spender, uint256 _subtractedValue ) public returns (bool) { uint256 oldValue = allowed[msg.sender][_spender]; if (_subtractedValue > oldValue) { allowed[msg.sender][_spender] = 0; } else { allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue); } emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]); return true; }
/** * @dev Decrease the amount of tokens that an owner allowed to a spender. * * approve should be called when allowed[_spender] == 0. To decrement * allowed value is better to use this function to avoid 2 calls (and wait until * the first transaction is mined) * From MonolithDAO Token.sol * @param _spender The address which will spend the funds. * @param _subtractedValue The amount of tokens to decrease the allowance by. */
NatSpecMultiLine
v0.4.24+commit.e67f0147
bzzr://99f1cc6586a4044c761ad50c56ee8509a948ad9a6fc3b8884817dde67b6fe823
{ "func_code_index": [ 3454, 3903 ] }
2,368
FooToken
FooToken.sol
0x415a9fd755a63cafddfcd35f95e169f2879559c9
Solidity
MintableToken
contract MintableToken is StandardToken, Ownable { event Mint(address indexed to, uint256 amount); event MintFinished(); bool public mintingFinished = false; modifier canMint() { require(!mintingFinished); _; } modifier hasMintPermission() { require(msg.sender == owner); _; } /** * @dev Function to mint tokens * @param _to The address that will receive the minted tokens. * @param _amount The amount of tokens to mint. * @return A boolean that indicates if the operation was successful. */ function mint( address _to, uint256 _amount ) hasMintPermission canMint public returns (bool) { totalSupply_ = totalSupply_.add(_amount); balances[_to] = balances[_to].add(_amount); emit Mint(_to, _amount); emit Transfer(address(0), _to, _amount); return true; } /** * @dev Function to stop minting new tokens. * @return True if the operation was successful. */ function finishMinting() onlyOwner canMint public returns (bool) { mintingFinished = true; emit MintFinished(); return true; } }
/** * @title Mintable token * @dev Simple ERC20 Token example, with mintable token creation * @dev Issue: * https://github.com/OpenZeppelin/openzeppelin-solidity/issues/120 * Based on code by TokenMarketNet: https://github.com/TokenMarketNet/ico/blob/master/contracts/MintableToken.sol */
NatSpecMultiLine
mint
function mint( address _to, uint256 _amount ) hasMintPermission canMint public returns (bool) { totalSupply_ = totalSupply_.add(_amount); balances[_to] = balances[_to].add(_amount); emit Mint(_to, _amount); emit Transfer(address(0), _to, _amount); return true; }
/** * @dev Function to mint tokens * @param _to The address that will receive the minted tokens. * @param _amount The amount of tokens to mint. * @return A boolean that indicates if the operation was successful. */
NatSpecMultiLine
v0.4.24+commit.e67f0147
bzzr://99f1cc6586a4044c761ad50c56ee8509a948ad9a6fc3b8884817dde67b6fe823
{ "func_code_index": [ 567, 896 ] }
2,369
FooToken
FooToken.sol
0x415a9fd755a63cafddfcd35f95e169f2879559c9
Solidity
MintableToken
contract MintableToken is StandardToken, Ownable { event Mint(address indexed to, uint256 amount); event MintFinished(); bool public mintingFinished = false; modifier canMint() { require(!mintingFinished); _; } modifier hasMintPermission() { require(msg.sender == owner); _; } /** * @dev Function to mint tokens * @param _to The address that will receive the minted tokens. * @param _amount The amount of tokens to mint. * @return A boolean that indicates if the operation was successful. */ function mint( address _to, uint256 _amount ) hasMintPermission canMint public returns (bool) { totalSupply_ = totalSupply_.add(_amount); balances[_to] = balances[_to].add(_amount); emit Mint(_to, _amount); emit Transfer(address(0), _to, _amount); return true; } /** * @dev Function to stop minting new tokens. * @return True if the operation was successful. */ function finishMinting() onlyOwner canMint public returns (bool) { mintingFinished = true; emit MintFinished(); return true; } }
/** * @title Mintable token * @dev Simple ERC20 Token example, with mintable token creation * @dev Issue: * https://github.com/OpenZeppelin/openzeppelin-solidity/issues/120 * Based on code by TokenMarketNet: https://github.com/TokenMarketNet/ico/blob/master/contracts/MintableToken.sol */
NatSpecMultiLine
finishMinting
function finishMinting() onlyOwner canMint public returns (bool) { mintingFinished = true; emit MintFinished(); return true; }
/** * @dev Function to stop minting new tokens. * @return True if the operation was successful. */
NatSpecMultiLine
v0.4.24+commit.e67f0147
bzzr://99f1cc6586a4044c761ad50c56ee8509a948ad9a6fc3b8884817dde67b6fe823
{ "func_code_index": [ 1013, 1160 ] }
2,370
FooToken
FooToken.sol
0x415a9fd755a63cafddfcd35f95e169f2879559c9
Solidity
CappedToken
contract CappedToken is MintableToken { uint256 public cap; constructor(uint256 _cap) public { require(_cap > 0); cap = _cap; } function getCap() external returns(uint256 capToken) { capToken = cap; } /** * @dev Function to mint tokens * @param _to The address that will receive the minted tokens. * @param _amount The amount of tokens to mint. * @return A boolean that indicates if the operation was successful. */ function mint( address _to, uint256 _amount ) public returns (bool) { require(totalSupply_.add(_amount) <= cap); return super.mint(_to, _amount); } }
/** * @title Capped token * @dev Mintable token with a token cap. */
NatSpecMultiLine
mint
function mint( address _to, uint256 _amount ) public returns (bool) { require(totalSupply_.add(_amount) <= cap); return super.mint(_to, _amount); }
/** * @dev Function to mint tokens * @param _to The address that will receive the minted tokens. * @param _amount The amount of tokens to mint. * @return A boolean that indicates if the operation was successful. */
NatSpecMultiLine
v0.4.24+commit.e67f0147
bzzr://99f1cc6586a4044c761ad50c56ee8509a948ad9a6fc3b8884817dde67b6fe823
{ "func_code_index": [ 482, 673 ] }
2,371
FooToken
FooToken.sol
0x415a9fd755a63cafddfcd35f95e169f2879559c9
Solidity
FooToken
contract FooToken is CappedToken { string public constant version="1.0.0"; string public constant name = "Foo Token"; string public constant symbol = "FOO"; uint8 public constant decimals = 18; uint256 public closingTime; //set cap token constructor(uint256 _closingTime) public CappedToken(uint256(100000000 * uint256(10 ** uint256(decimals)))) { require(block.timestamp < _closingTime); closingTime = _closingTime; } /** * @dev Override mint for implement block mint when ICO finish * @param _to The address that will receive the minted tokens. * @param _amount The amount of tokens to mint. * @return A boolean that indicates if the operation was successful. */ function mint( address _to, uint256 _amount ) public returns (bool) { require(block.timestamp < closingTime); return super.mint(_to, _amount); } /** * @dev function for change date finish mint * @param _closingTime date of closing mint */ function changeClosingTime(uint256 _closingTime) public onlyOwner { require(block.timestamp < _closingTime); closingTime = _closingTime; } /** * @dev override transferFrom for block transfer before ico finish */ function transferFrom(address _from,address _to,uint256 _value) public returns (bool) { require(block.timestamp >= closingTime); return super.transferFrom(_from,_to,_value); } /** * @dev override transfer for block transfer before ico finish */ function transfer(address _to, uint256 _value) public returns (bool) { require(block.timestamp >= closingTime); return super.transfer(_to, _value); } }
/** * @title FooToken * @dev Very simple ERC20 Token that can be minted with Cap. * Import contract CappedToken,MintableToken,StandardToken,ERC20,ERC20Basic,BasicToken,Ownable. * Import library SafeMath. */
NatSpecMultiLine
mint
function mint( address _to, uint256 _amount ) public returns (bool) { require(block.timestamp < closingTime); return super.mint(_to, _amount); }
/** * @dev Override mint for implement block mint when ICO finish * @param _to The address that will receive the minted tokens. * @param _amount The amount of tokens to mint. * @return A boolean that indicates if the operation was successful. */
NatSpecMultiLine
v0.4.24+commit.e67f0147
bzzr://99f1cc6586a4044c761ad50c56ee8509a948ad9a6fc3b8884817dde67b6fe823
{ "func_code_index": [ 732, 918 ] }
2,372
FooToken
FooToken.sol
0x415a9fd755a63cafddfcd35f95e169f2879559c9
Solidity
FooToken
contract FooToken is CappedToken { string public constant version="1.0.0"; string public constant name = "Foo Token"; string public constant symbol = "FOO"; uint8 public constant decimals = 18; uint256 public closingTime; //set cap token constructor(uint256 _closingTime) public CappedToken(uint256(100000000 * uint256(10 ** uint256(decimals)))) { require(block.timestamp < _closingTime); closingTime = _closingTime; } /** * @dev Override mint for implement block mint when ICO finish * @param _to The address that will receive the minted tokens. * @param _amount The amount of tokens to mint. * @return A boolean that indicates if the operation was successful. */ function mint( address _to, uint256 _amount ) public returns (bool) { require(block.timestamp < closingTime); return super.mint(_to, _amount); } /** * @dev function for change date finish mint * @param _closingTime date of closing mint */ function changeClosingTime(uint256 _closingTime) public onlyOwner { require(block.timestamp < _closingTime); closingTime = _closingTime; } /** * @dev override transferFrom for block transfer before ico finish */ function transferFrom(address _from,address _to,uint256 _value) public returns (bool) { require(block.timestamp >= closingTime); return super.transferFrom(_from,_to,_value); } /** * @dev override transfer for block transfer before ico finish */ function transfer(address _to, uint256 _value) public returns (bool) { require(block.timestamp >= closingTime); return super.transfer(_to, _value); } }
/** * @title FooToken * @dev Very simple ERC20 Token that can be minted with Cap. * Import contract CappedToken,MintableToken,StandardToken,ERC20,ERC20Basic,BasicToken,Ownable. * Import library SafeMath. */
NatSpecMultiLine
changeClosingTime
function changeClosingTime(uint256 _closingTime) public onlyOwner { require(block.timestamp < _closingTime); closingTime = _closingTime; }
/** * @dev function for change date finish mint * @param _closingTime date of closing mint */
NatSpecMultiLine
v0.4.24+commit.e67f0147
bzzr://99f1cc6586a4044c761ad50c56ee8509a948ad9a6fc3b8884817dde67b6fe823
{ "func_code_index": [ 1025, 1179 ] }
2,373
FooToken
FooToken.sol
0x415a9fd755a63cafddfcd35f95e169f2879559c9
Solidity
FooToken
contract FooToken is CappedToken { string public constant version="1.0.0"; string public constant name = "Foo Token"; string public constant symbol = "FOO"; uint8 public constant decimals = 18; uint256 public closingTime; //set cap token constructor(uint256 _closingTime) public CappedToken(uint256(100000000 * uint256(10 ** uint256(decimals)))) { require(block.timestamp < _closingTime); closingTime = _closingTime; } /** * @dev Override mint for implement block mint when ICO finish * @param _to The address that will receive the minted tokens. * @param _amount The amount of tokens to mint. * @return A boolean that indicates if the operation was successful. */ function mint( address _to, uint256 _amount ) public returns (bool) { require(block.timestamp < closingTime); return super.mint(_to, _amount); } /** * @dev function for change date finish mint * @param _closingTime date of closing mint */ function changeClosingTime(uint256 _closingTime) public onlyOwner { require(block.timestamp < _closingTime); closingTime = _closingTime; } /** * @dev override transferFrom for block transfer before ico finish */ function transferFrom(address _from,address _to,uint256 _value) public returns (bool) { require(block.timestamp >= closingTime); return super.transferFrom(_from,_to,_value); } /** * @dev override transfer for block transfer before ico finish */ function transfer(address _to, uint256 _value) public returns (bool) { require(block.timestamp >= closingTime); return super.transfer(_to, _value); } }
/** * @title FooToken * @dev Very simple ERC20 Token that can be minted with Cap. * Import contract CappedToken,MintableToken,StandardToken,ERC20,ERC20Basic,BasicToken,Ownable. * Import library SafeMath. */
NatSpecMultiLine
transferFrom
function transferFrom(address _from,address _to,uint256 _value) public returns (bool) { require(block.timestamp >= closingTime); return super.transferFrom(_from,_to,_value); }
/** * @dev override transferFrom for block transfer before ico finish */
NatSpecMultiLine
v0.4.24+commit.e67f0147
bzzr://99f1cc6586a4044c761ad50c56ee8509a948ad9a6fc3b8884817dde67b6fe823
{ "func_code_index": [ 1262, 1453 ] }
2,374
FooToken
FooToken.sol
0x415a9fd755a63cafddfcd35f95e169f2879559c9
Solidity
FooToken
contract FooToken is CappedToken { string public constant version="1.0.0"; string public constant name = "Foo Token"; string public constant symbol = "FOO"; uint8 public constant decimals = 18; uint256 public closingTime; //set cap token constructor(uint256 _closingTime) public CappedToken(uint256(100000000 * uint256(10 ** uint256(decimals)))) { require(block.timestamp < _closingTime); closingTime = _closingTime; } /** * @dev Override mint for implement block mint when ICO finish * @param _to The address that will receive the minted tokens. * @param _amount The amount of tokens to mint. * @return A boolean that indicates if the operation was successful. */ function mint( address _to, uint256 _amount ) public returns (bool) { require(block.timestamp < closingTime); return super.mint(_to, _amount); } /** * @dev function for change date finish mint * @param _closingTime date of closing mint */ function changeClosingTime(uint256 _closingTime) public onlyOwner { require(block.timestamp < _closingTime); closingTime = _closingTime; } /** * @dev override transferFrom for block transfer before ico finish */ function transferFrom(address _from,address _to,uint256 _value) public returns (bool) { require(block.timestamp >= closingTime); return super.transferFrom(_from,_to,_value); } /** * @dev override transfer for block transfer before ico finish */ function transfer(address _to, uint256 _value) public returns (bool) { require(block.timestamp >= closingTime); return super.transfer(_to, _value); } }
/** * @title FooToken * @dev Very simple ERC20 Token that can be minted with Cap. * Import contract CappedToken,MintableToken,StandardToken,ERC20,ERC20Basic,BasicToken,Ownable. * Import library SafeMath. */
NatSpecMultiLine
transfer
function transfer(address _to, uint256 _value) public returns (bool) { require(block.timestamp >= closingTime); return super.transfer(_to, _value); }
/** * @dev override transfer for block transfer before ico finish */
NatSpecMultiLine
v0.4.24+commit.e67f0147
bzzr://99f1cc6586a4044c761ad50c56ee8509a948ad9a6fc3b8884817dde67b6fe823
{ "func_code_index": [ 1532, 1697 ] }
2,375
DMGYieldFarmingRouter
contracts/utils/AddressUtil.sol
0x85455fc1428ceee0072309f87a227d53783ba6a8
Solidity
AddressUtil
library AddressUtil { using AddressUtil for *; function isContract( address addr ) internal view returns (bool) { uint32 size; assembly {size := extcodesize(addr)} return (size > 0); } function toPayable( address addr ) internal pure returns (address payable) { return address(uint160(addr)); } // Works like address.send but with a customizable gas limit // Make sure your code is safe for reentrancy when using this function! function sendETH( address to, uint amount ) internal returns (bool success) { if (amount == 0) { return true; } address payable recipient = to.toPayable(); require(address(this).balance >= amount, "AddressUtil::sendETH: INSUFFICIENT_BALANCE"); /* solium-disable-next-line */ (success,) = recipient.call.value(amount)(""); } // Works like address.transfer but with a customizable gas limit // Make sure your code is safe for reentrancy when using this function! function sendETHAndVerify( address to, uint amount ) internal returns (bool success) { success = to.sendETH(amount); require(success, "TRANSFER_FAILURE"); } }
/// @title Utility Functions for addresses /// @author Daniel Wang - <[email protected]> /// @author Brecht Devos - <[email protected]>
NatSpecSingleLine
sendETH
function sendETH( address to, uint amount ) internal returns (bool success) { if (amount == 0) { return true; } address payable recipient = to.toPayable(); require(address(this).balance >= amount, "AddressUtil::sendETH: INSUFFICIENT_BALANCE"); /* solium-disable-next-line */ (success,) = recipient.call.value(amount)(""); }
// Works like address.send but with a customizable gas limit // Make sure your code is safe for reentrancy when using this function!
LineComment
v0.5.13+commit.5b0b510c
Apache-2.0
bzzr://109d8c35d03b8ade3d7a4b4f689a030d34e0cce256c34dbd0f4a6b95b7701a2e
{ "func_code_index": [ 575, 1012 ] }
2,376
DMGYieldFarmingRouter
contracts/utils/AddressUtil.sol
0x85455fc1428ceee0072309f87a227d53783ba6a8
Solidity
AddressUtil
library AddressUtil { using AddressUtil for *; function isContract( address addr ) internal view returns (bool) { uint32 size; assembly {size := extcodesize(addr)} return (size > 0); } function toPayable( address addr ) internal pure returns (address payable) { return address(uint160(addr)); } // Works like address.send but with a customizable gas limit // Make sure your code is safe for reentrancy when using this function! function sendETH( address to, uint amount ) internal returns (bool success) { if (amount == 0) { return true; } address payable recipient = to.toPayable(); require(address(this).balance >= amount, "AddressUtil::sendETH: INSUFFICIENT_BALANCE"); /* solium-disable-next-line */ (success,) = recipient.call.value(amount)(""); } // Works like address.transfer but with a customizable gas limit // Make sure your code is safe for reentrancy when using this function! function sendETHAndVerify( address to, uint amount ) internal returns (bool success) { success = to.sendETH(amount); require(success, "TRANSFER_FAILURE"); } }
/// @title Utility Functions for addresses /// @author Daniel Wang - <[email protected]> /// @author Brecht Devos - <[email protected]>
NatSpecSingleLine
sendETHAndVerify
function sendETHAndVerify( address to, uint amount ) internal returns (bool success) { success = to.sendETH(amount); require(success, "TRANSFER_FAILURE"); }
// Works like address.transfer but with a customizable gas limit // Make sure your code is safe for reentrancy when using this function!
LineComment
v0.5.13+commit.5b0b510c
Apache-2.0
bzzr://109d8c35d03b8ade3d7a4b4f689a030d34e0cce256c34dbd0f4a6b95b7701a2e
{ "func_code_index": [ 1162, 1384 ] }
2,377
YFIIsilverStaking
YFIIsilverStaking.sol
0x7819487ecd1314beaf54c7f5847860882e104ff2
Solidity
EnumerableSet
library EnumerableSet { struct Set { bytes32[] _values; mapping (bytes32 => uint256) _indexes; } function _add(Set storage set, bytes32 value) private returns (bool) { if (!_contains(set, value)) { set._values.push(value); set._indexes[value] = set._values.length; return true; } else { return false; } } function _remove(Set storage set, bytes32 value) private returns (bool) { // We read and store the value's index to prevent multiple reads from the same storage slot uint256 valueIndex = set._indexes[value]; if (valueIndex != 0) { // Equivalent to contains(set, value) uint256 toDeleteIndex = valueIndex - 1; uint256 lastIndex = set._values.length - 1; bytes32 lastvalue = set._values[lastIndex]; // Move the last value to the index where the value to delete is set._values[toDeleteIndex] = lastvalue; // Update the index for the moved value set._indexes[lastvalue] = toDeleteIndex + 1; // All indexes are 1-based // Delete the slot where the moved value was stored set._values.pop(); // Delete the index for the deleted slot delete set._indexes[value]; return true; } else { return false; } } /** * @dev Returns true if the value is in the set. O(1). */ function _contains(Set storage set, bytes32 value) private view returns (bool) { return set._indexes[value] != 0; } function _length(Set storage set) private view returns (uint256) { return set._values.length; } function _at(Set storage set, uint256 index) private view returns (bytes32) { require(set._values.length > index, "EnumerableSet: index out of bounds"); return set._values[index]; } // AddressSet struct AddressSet { Set _inner; } function add(AddressSet storage set, address value) internal returns (bool) { return _add(set._inner, bytes32(uint256(value))); } function remove(AddressSet storage set, address value) internal returns (bool) { return _remove(set._inner, bytes32(uint256(value))); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(AddressSet storage set, address value) internal view returns (bool) { return _contains(set._inner, bytes32(uint256(value))); } /** * @dev Returns the number of values in the set. O(1). */ function length(AddressSet storage set) internal view returns (uint256) { return _length(set._inner); } function at(AddressSet storage set, uint256 index) internal view returns (address) { return address(uint256(_at(set._inner, index))); } // UintSet struct UintSet { Set _inner; } function add(UintSet storage set, uint256 value) internal returns (bool) { return _add(set._inner, bytes32(value)); } function remove(UintSet storage set, uint256 value) internal returns (bool) { return _remove(set._inner, bytes32(value)); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(UintSet storage set, uint256 value) internal view returns (bool) { return _contains(set._inner, bytes32(value)); } function length(UintSet storage set) internal view returns (uint256) { return _length(set._inner); } function at(UintSet storage set, uint256 index) internal view returns (uint256) { return uint256(_at(set._inner, index)); } }
_contains
function _contains(Set storage set, bytes32 value) private view returns (bool) { return set._indexes[value] != 0; }
/** * @dev Returns true if the value is in the set. O(1). */
NatSpecMultiLine
v0.6.12+commit.27d51765
None
ipfs://a2efe3ee853c819cd12fdee1468873691a68beff29075609e9eea92f0b513c1c
{ "func_code_index": [ 1555, 1689 ] }
2,378
YFIIsilverStaking
YFIIsilverStaking.sol
0x7819487ecd1314beaf54c7f5847860882e104ff2
Solidity
EnumerableSet
library EnumerableSet { struct Set { bytes32[] _values; mapping (bytes32 => uint256) _indexes; } function _add(Set storage set, bytes32 value) private returns (bool) { if (!_contains(set, value)) { set._values.push(value); set._indexes[value] = set._values.length; return true; } else { return false; } } function _remove(Set storage set, bytes32 value) private returns (bool) { // We read and store the value's index to prevent multiple reads from the same storage slot uint256 valueIndex = set._indexes[value]; if (valueIndex != 0) { // Equivalent to contains(set, value) uint256 toDeleteIndex = valueIndex - 1; uint256 lastIndex = set._values.length - 1; bytes32 lastvalue = set._values[lastIndex]; // Move the last value to the index where the value to delete is set._values[toDeleteIndex] = lastvalue; // Update the index for the moved value set._indexes[lastvalue] = toDeleteIndex + 1; // All indexes are 1-based // Delete the slot where the moved value was stored set._values.pop(); // Delete the index for the deleted slot delete set._indexes[value]; return true; } else { return false; } } /** * @dev Returns true if the value is in the set. O(1). */ function _contains(Set storage set, bytes32 value) private view returns (bool) { return set._indexes[value] != 0; } function _length(Set storage set) private view returns (uint256) { return set._values.length; } function _at(Set storage set, uint256 index) private view returns (bytes32) { require(set._values.length > index, "EnumerableSet: index out of bounds"); return set._values[index]; } // AddressSet struct AddressSet { Set _inner; } function add(AddressSet storage set, address value) internal returns (bool) { return _add(set._inner, bytes32(uint256(value))); } function remove(AddressSet storage set, address value) internal returns (bool) { return _remove(set._inner, bytes32(uint256(value))); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(AddressSet storage set, address value) internal view returns (bool) { return _contains(set._inner, bytes32(uint256(value))); } /** * @dev Returns the number of values in the set. O(1). */ function length(AddressSet storage set) internal view returns (uint256) { return _length(set._inner); } function at(AddressSet storage set, uint256 index) internal view returns (address) { return address(uint256(_at(set._inner, index))); } // UintSet struct UintSet { Set _inner; } function add(UintSet storage set, uint256 value) internal returns (bool) { return _add(set._inner, bytes32(value)); } function remove(UintSet storage set, uint256 value) internal returns (bool) { return _remove(set._inner, bytes32(value)); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(UintSet storage set, uint256 value) internal view returns (bool) { return _contains(set._inner, bytes32(value)); } function length(UintSet storage set) internal view returns (uint256) { return _length(set._inner); } function at(UintSet storage set, uint256 index) internal view returns (uint256) { return uint256(_at(set._inner, index)); } }
contains
function contains(AddressSet storage set, address value) internal view returns (bool) { return _contains(set._inner, bytes32(uint256(value))); }
/** * @dev Returns true if the value is in the set. O(1). */
NatSpecMultiLine
v0.6.12+commit.27d51765
None
ipfs://a2efe3ee853c819cd12fdee1468873691a68beff29075609e9eea92f0b513c1c
{ "func_code_index": [ 2483, 2646 ] }
2,379
YFIIsilverStaking
YFIIsilverStaking.sol
0x7819487ecd1314beaf54c7f5847860882e104ff2
Solidity
EnumerableSet
library EnumerableSet { struct Set { bytes32[] _values; mapping (bytes32 => uint256) _indexes; } function _add(Set storage set, bytes32 value) private returns (bool) { if (!_contains(set, value)) { set._values.push(value); set._indexes[value] = set._values.length; return true; } else { return false; } } function _remove(Set storage set, bytes32 value) private returns (bool) { // We read and store the value's index to prevent multiple reads from the same storage slot uint256 valueIndex = set._indexes[value]; if (valueIndex != 0) { // Equivalent to contains(set, value) uint256 toDeleteIndex = valueIndex - 1; uint256 lastIndex = set._values.length - 1; bytes32 lastvalue = set._values[lastIndex]; // Move the last value to the index where the value to delete is set._values[toDeleteIndex] = lastvalue; // Update the index for the moved value set._indexes[lastvalue] = toDeleteIndex + 1; // All indexes are 1-based // Delete the slot where the moved value was stored set._values.pop(); // Delete the index for the deleted slot delete set._indexes[value]; return true; } else { return false; } } /** * @dev Returns true if the value is in the set. O(1). */ function _contains(Set storage set, bytes32 value) private view returns (bool) { return set._indexes[value] != 0; } function _length(Set storage set) private view returns (uint256) { return set._values.length; } function _at(Set storage set, uint256 index) private view returns (bytes32) { require(set._values.length > index, "EnumerableSet: index out of bounds"); return set._values[index]; } // AddressSet struct AddressSet { Set _inner; } function add(AddressSet storage set, address value) internal returns (bool) { return _add(set._inner, bytes32(uint256(value))); } function remove(AddressSet storage set, address value) internal returns (bool) { return _remove(set._inner, bytes32(uint256(value))); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(AddressSet storage set, address value) internal view returns (bool) { return _contains(set._inner, bytes32(uint256(value))); } /** * @dev Returns the number of values in the set. O(1). */ function length(AddressSet storage set) internal view returns (uint256) { return _length(set._inner); } function at(AddressSet storage set, uint256 index) internal view returns (address) { return address(uint256(_at(set._inner, index))); } // UintSet struct UintSet { Set _inner; } function add(UintSet storage set, uint256 value) internal returns (bool) { return _add(set._inner, bytes32(value)); } function remove(UintSet storage set, uint256 value) internal returns (bool) { return _remove(set._inner, bytes32(value)); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(UintSet storage set, uint256 value) internal view returns (bool) { return _contains(set._inner, bytes32(value)); } function length(UintSet storage set) internal view returns (uint256) { return _length(set._inner); } function at(UintSet storage set, uint256 index) internal view returns (uint256) { return uint256(_at(set._inner, index)); } }
length
function length(AddressSet storage set) internal view returns (uint256) { return _length(set._inner); }
/** * @dev Returns the number of values in the set. O(1). */
NatSpecMultiLine
v0.6.12+commit.27d51765
None
ipfs://a2efe3ee853c819cd12fdee1468873691a68beff29075609e9eea92f0b513c1c
{ "func_code_index": [ 2727, 2849 ] }
2,380
YFIIsilverStaking
YFIIsilverStaking.sol
0x7819487ecd1314beaf54c7f5847860882e104ff2
Solidity
EnumerableSet
library EnumerableSet { struct Set { bytes32[] _values; mapping (bytes32 => uint256) _indexes; } function _add(Set storage set, bytes32 value) private returns (bool) { if (!_contains(set, value)) { set._values.push(value); set._indexes[value] = set._values.length; return true; } else { return false; } } function _remove(Set storage set, bytes32 value) private returns (bool) { // We read and store the value's index to prevent multiple reads from the same storage slot uint256 valueIndex = set._indexes[value]; if (valueIndex != 0) { // Equivalent to contains(set, value) uint256 toDeleteIndex = valueIndex - 1; uint256 lastIndex = set._values.length - 1; bytes32 lastvalue = set._values[lastIndex]; // Move the last value to the index where the value to delete is set._values[toDeleteIndex] = lastvalue; // Update the index for the moved value set._indexes[lastvalue] = toDeleteIndex + 1; // All indexes are 1-based // Delete the slot where the moved value was stored set._values.pop(); // Delete the index for the deleted slot delete set._indexes[value]; return true; } else { return false; } } /** * @dev Returns true if the value is in the set. O(1). */ function _contains(Set storage set, bytes32 value) private view returns (bool) { return set._indexes[value] != 0; } function _length(Set storage set) private view returns (uint256) { return set._values.length; } function _at(Set storage set, uint256 index) private view returns (bytes32) { require(set._values.length > index, "EnumerableSet: index out of bounds"); return set._values[index]; } // AddressSet struct AddressSet { Set _inner; } function add(AddressSet storage set, address value) internal returns (bool) { return _add(set._inner, bytes32(uint256(value))); } function remove(AddressSet storage set, address value) internal returns (bool) { return _remove(set._inner, bytes32(uint256(value))); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(AddressSet storage set, address value) internal view returns (bool) { return _contains(set._inner, bytes32(uint256(value))); } /** * @dev Returns the number of values in the set. O(1). */ function length(AddressSet storage set) internal view returns (uint256) { return _length(set._inner); } function at(AddressSet storage set, uint256 index) internal view returns (address) { return address(uint256(_at(set._inner, index))); } // UintSet struct UintSet { Set _inner; } function add(UintSet storage set, uint256 value) internal returns (bool) { return _add(set._inner, bytes32(value)); } function remove(UintSet storage set, uint256 value) internal returns (bool) { return _remove(set._inner, bytes32(value)); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(UintSet storage set, uint256 value) internal view returns (bool) { return _contains(set._inner, bytes32(value)); } function length(UintSet storage set) internal view returns (uint256) { return _length(set._inner); } function at(UintSet storage set, uint256 index) internal view returns (uint256) { return uint256(_at(set._inner, index)); } }
contains
function contains(UintSet storage set, uint256 value) internal view returns (bool) { return _contains(set._inner, bytes32(value)); }
/** * @dev Returns true if the value is in the set. O(1). */
NatSpecMultiLine
v0.6.12+commit.27d51765
None
ipfs://a2efe3ee853c819cd12fdee1468873691a68beff29075609e9eea92f0b513c1c
{ "func_code_index": [ 3443, 3594 ] }
2,381
YFIIsilverStaking
YFIIsilverStaking.sol
0x7819487ecd1314beaf54c7f5847860882e104ff2
Solidity
YFIIsilverStaking
contract YFIIsilverStaking is Ownable { using SafeMath for uint; using EnumerableSet for EnumerableSet.AddressSet; event RewardsTransferred(address holder, uint amount); // YFIIsilver token contract address address public constant tokenAddress = 0x32F3b9B5Bd6C76F41ee3B389573f340468666861; // reward rate 70.00% per year uint public constant rewardRate = 7000; // 7000 ÷ 100 = 70 % uint public constant rewardInterval = 365 days; // APY (Annual Percentage Yield) // staking fee 1 percent uint public constant stakingFeeRate = 100; // 100 ÷ 100 = 1 % // unstaking fee 0.5 percent uint public constant unstakingFeeRate = 50; // 50 ÷ 100 = 0.5 % // unstaking possible after 15 Days uint public constant cliffTime = 15 days; uint public totalClaimedRewards = 0; EnumerableSet.AddressSet private holders; mapping (address => uint) public depositedTokens; mapping (address => uint) public stakingTime; mapping (address => uint) public lastClaimedTime; mapping (address => uint) public totalEarnedTokens; function updateAccount(address account) private { uint pendingDivs = getPendingDivs(account); if (pendingDivs > 0) { require(Token(tokenAddress).transfer(account, pendingDivs), "Could not transfer tokens."); totalEarnedTokens[account] = totalEarnedTokens[account].add(pendingDivs); totalClaimedRewards = totalClaimedRewards.add(pendingDivs); emit RewardsTransferred(account, pendingDivs); } lastClaimedTime[account] = now; } function getPendingDivs(address _holder) public view returns (uint) { if (!holders.contains(_holder)) return 0; if (depositedTokens[_holder] == 0) return 0; uint timeDiff = now.sub(lastClaimedTime[_holder]); uint stakedAmount = depositedTokens[_holder]; uint pendingDivs = stakedAmount .mul(rewardRate) .mul(timeDiff) .div(rewardInterval) .div(1e4); return pendingDivs; } function getNumberOfHolders() public view returns (uint) { return holders.length(); } function deposit(uint amountToStake) public { require(amountToStake > 0, "Cannot deposit 0 Tokens"); require(Token(tokenAddress).transferFrom(msg.sender, address(this), amountToStake), "Insufficient Token Allowance"); updateAccount(msg.sender); uint fee = amountToStake.mul(stakingFeeRate).div(1e4); uint amountAfterFee = amountToStake.sub(fee); require(Token(tokenAddress).transfer(owner, fee), "Could not transfer deposit fee."); depositedTokens[msg.sender] = depositedTokens[msg.sender].add(amountAfterFee); if (!holders.contains(msg.sender)) { holders.add(msg.sender); stakingTime[msg.sender] = now; } } function withdraw(uint amountToWithdraw) public { require(depositedTokens[msg.sender] >= amountToWithdraw, "Invalid amount to withdraw"); require(now.sub(stakingTime[msg.sender]) > cliffTime, "You recently staked, please wait before withdrawing."); updateAccount(msg.sender); uint fee = amountToWithdraw.mul(unstakingFeeRate).div(1e4); uint amountAfterFee = amountToWithdraw.sub(fee); require(Token(tokenAddress).transfer(owner, fee), "Could not transfer withdraw fee."); require(Token(tokenAddress).transfer(msg.sender, amountAfterFee), "Could not transfer tokens."); depositedTokens[msg.sender] = depositedTokens[msg.sender].sub(amountToWithdraw); if (holders.contains(msg.sender) && depositedTokens[msg.sender] == 0) { holders.remove(msg.sender); } } function claimDivs() public { updateAccount(msg.sender); } uint private constant stakingAndDaoTokens = 100e18; function getStakingAndDaoAmount() public view returns (uint) { if (totalClaimedRewards >= stakingAndDaoTokens) { return 0; } uint remaining = stakingAndDaoTokens.sub(totalClaimedRewards); return remaining; } // function to allow admin to claim *other* ERC20 tokens sent to this contract (by mistake) function transferAnyERC20Tokens(address _tokenAddr, address _to, uint _amount) public onlyOwner { if (_tokenAddr == tokenAddress) { if (_amount > getStakingAndDaoAmount()) { revert(); } totalClaimedRewards = totalClaimedRewards.add(_amount); } Token(_tokenAddr).transfer(_to, _amount); } }
transferAnyERC20Tokens
function transferAnyERC20Tokens(address _tokenAddr, address _to, uint _amount) public onlyOwner { if (_tokenAddr == tokenAddress) { if (_amount > getStakingAndDaoAmount()) { revert(); } totalClaimedRewards = totalClaimedRewards.add(_amount); } Token(_tokenAddr).transfer(_to, _amount); }
// function to allow admin to claim *other* ERC20 tokens sent to this contract (by mistake)
LineComment
v0.6.12+commit.27d51765
None
ipfs://a2efe3ee853c819cd12fdee1468873691a68beff29075609e9eea92f0b513c1c
{ "func_code_index": [ 4658, 5038 ] }
2,382
SMNTokenERC20
SMNTokenERC20.sol
0xd60ca88533247a3b3cdeaff5f283b9efa2880231
Solidity
SMNTokenERC20
contract SMNTokenERC20 { // Public variables of the token string public name; string public symbol; uint8 public decimals = 18; // 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 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 tokenName, string tokenSymbol ) public { totalSupply = initialSupply * 10 ** uint256(decimals); // Update total supply with the decimal amount balanceOf[msg.sender] = totalSupply; // Give the creator all initial tokens name = tokenName; // Set the name for display purposes symbol = tokenSymbol; // 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 != 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 { _transfer(msg.sender, _to, _value); } /** * 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; 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 _extraData) public returns (bool success) { tokenRecipient spender = tokenRecipient(_spender); if (approve(_spender, _value)) { spender.receiveApproval(msg.sender, _value, 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 != 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.4.26+commit.4563c3fc
None
bzzr://0e530df137b967d4a7036a069e2a5a7397007cfda4cd38efe09e722a0429a7c8
{ "func_code_index": [ 1465, 2313 ] }
2,383
SMNTokenERC20
SMNTokenERC20.sol
0xd60ca88533247a3b3cdeaff5f283b9efa2880231
Solidity
SMNTokenERC20
contract SMNTokenERC20 { // Public variables of the token string public name; string public symbol; uint8 public decimals = 18; // 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 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 tokenName, string tokenSymbol ) public { totalSupply = initialSupply * 10 ** uint256(decimals); // Update total supply with the decimal amount balanceOf[msg.sender] = totalSupply; // Give the creator all initial tokens name = tokenName; // Set the name for display purposes symbol = tokenSymbol; // 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 != 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 { _transfer(msg.sender, _to, _value); } /** * 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; 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 _extraData) public returns (bool success) { tokenRecipient spender = tokenRecipient(_spender); if (approve(_spender, _value)) { spender.receiveApproval(msg.sender, _value, 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 { _transfer(msg.sender, _to, _value); }
/** * 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.4.26+commit.4563c3fc
None
bzzr://0e530df137b967d4a7036a069e2a5a7397007cfda4cd38efe09e722a0429a7c8
{ "func_code_index": [ 2519, 2631 ] }
2,384
SMNTokenERC20
SMNTokenERC20.sol
0xd60ca88533247a3b3cdeaff5f283b9efa2880231
Solidity
SMNTokenERC20
contract SMNTokenERC20 { // Public variables of the token string public name; string public symbol; uint8 public decimals = 18; // 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 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 tokenName, string tokenSymbol ) public { totalSupply = initialSupply * 10 ** uint256(decimals); // Update total supply with the decimal amount balanceOf[msg.sender] = totalSupply; // Give the creator all initial tokens name = tokenName; // Set the name for display purposes symbol = tokenSymbol; // 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 != 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 { _transfer(msg.sender, _to, _value); } /** * 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; 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 _extraData) public returns (bool success) { tokenRecipient spender = tokenRecipient(_spender); if (approve(_spender, _value)) { spender.receiveApproval(msg.sender, _value, 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.4.26+commit.4563c3fc
None
bzzr://0e530df137b967d4a7036a069e2a5a7397007cfda4cd38efe09e722a0429a7c8
{ "func_code_index": [ 2906, 3207 ] }
2,385
SMNTokenERC20
SMNTokenERC20.sol
0xd60ca88533247a3b3cdeaff5f283b9efa2880231
Solidity
SMNTokenERC20
contract SMNTokenERC20 { // Public variables of the token string public name; string public symbol; uint8 public decimals = 18; // 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 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 tokenName, string tokenSymbol ) public { totalSupply = initialSupply * 10 ** uint256(decimals); // Update total supply with the decimal amount balanceOf[msg.sender] = totalSupply; // Give the creator all initial tokens name = tokenName; // Set the name for display purposes symbol = tokenSymbol; // 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 != 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 { _transfer(msg.sender, _to, _value); } /** * 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; 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 _extraData) public returns (bool success) { tokenRecipient spender = tokenRecipient(_spender); if (approve(_spender, _value)) { spender.receiveApproval(msg.sender, _value, 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; 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.4.26+commit.4563c3fc
None
bzzr://0e530df137b967d4a7036a069e2a5a7397007cfda4cd38efe09e722a0429a7c8
{ "func_code_index": [ 3471, 3647 ] }
2,386
SMNTokenERC20
SMNTokenERC20.sol
0xd60ca88533247a3b3cdeaff5f283b9efa2880231
Solidity
SMNTokenERC20
contract SMNTokenERC20 { // Public variables of the token string public name; string public symbol; uint8 public decimals = 18; // 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 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 tokenName, string tokenSymbol ) public { totalSupply = initialSupply * 10 ** uint256(decimals); // Update total supply with the decimal amount balanceOf[msg.sender] = totalSupply; // Give the creator all initial tokens name = tokenName; // Set the name for display purposes symbol = tokenSymbol; // 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 != 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 { _transfer(msg.sender, _to, _value); } /** * 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; 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 _extraData) public returns (bool success) { tokenRecipient spender = tokenRecipient(_spender); if (approve(_spender, _value)) { spender.receiveApproval(msg.sender, _value, 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 _extraData) public returns (bool success) { tokenRecipient spender = tokenRecipient(_spender); if (approve(_spender, _value)) { spender.receiveApproval(msg.sender, _value, 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.4.26+commit.4563c3fc
None
bzzr://0e530df137b967d4a7036a069e2a5a7397007cfda4cd38efe09e722a0429a7c8
{ "func_code_index": [ 4041, 4393 ] }
2,387
SMNTokenERC20
SMNTokenERC20.sol
0xd60ca88533247a3b3cdeaff5f283b9efa2880231
Solidity
SMNTokenERC20
contract SMNTokenERC20 { // Public variables of the token string public name; string public symbol; uint8 public decimals = 18; // 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 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 tokenName, string tokenSymbol ) public { totalSupply = initialSupply * 10 ** uint256(decimals); // Update total supply with the decimal amount balanceOf[msg.sender] = totalSupply; // Give the creator all initial tokens name = tokenName; // Set the name for display purposes symbol = tokenSymbol; // 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 != 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 { _transfer(msg.sender, _to, _value); } /** * 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; 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 _extraData) public returns (bool success) { tokenRecipient spender = tokenRecipient(_spender); if (approve(_spender, _value)) { spender.receiveApproval(msg.sender, _value, 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.4.26+commit.4563c3fc
None
bzzr://0e530df137b967d4a7036a069e2a5a7397007cfda4cd38efe09e722a0429a7c8
{ "func_code_index": [ 4563, 4942 ] }
2,388
SMNTokenERC20
SMNTokenERC20.sol
0xd60ca88533247a3b3cdeaff5f283b9efa2880231
Solidity
SMNTokenERC20
contract SMNTokenERC20 { // Public variables of the token string public name; string public symbol; uint8 public decimals = 18; // 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 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 tokenName, string tokenSymbol ) public { totalSupply = initialSupply * 10 ** uint256(decimals); // Update total supply with the decimal amount balanceOf[msg.sender] = totalSupply; // Give the creator all initial tokens name = tokenName; // Set the name for display purposes symbol = tokenSymbol; // 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 != 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 { _transfer(msg.sender, _to, _value); } /** * 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; 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 _extraData) public returns (bool success) { tokenRecipient spender = tokenRecipient(_spender); if (approve(_spender, _value)) { spender.receiveApproval(msg.sender, _value, 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.4.26+commit.4563c3fc
None
bzzr://0e530df137b967d4a7036a069e2a5a7397007cfda4cd38efe09e722a0429a7c8
{ "func_code_index": [ 5200, 5816 ] }
2,389
ENSMigrationSubdomainRegistrar
@ensdomains/subdomain-registrar/contracts/RegistrarInterface.sol
0xe65d8aaf34cb91087d1598e0a15b582f57f217d9
Solidity
RegistrarInterface
contract RegistrarInterface { event OwnerChanged(bytes32 indexed label, address indexed oldOwner, address indexed newOwner); event DomainConfigured(bytes32 indexed label); event DomainUnlisted(bytes32 indexed label); event NewRegistration(bytes32 indexed label, string subdomain, address indexed owner, address indexed referrer, uint price); event RentPaid(bytes32 indexed label, string subdomain, uint amount, uint expirationDate); // InterfaceID of these four methods is 0xc1b15f5a function query(bytes32 label, string calldata subdomain) external view returns (string memory domain, uint signupFee, uint rent, uint referralFeePPM); function register(bytes32 label, string calldata subdomain, address owner, address payable referrer, address resolver) external payable; function rentDue(bytes32 label, string calldata subdomain) external view returns (uint timestamp); function payRent(bytes32 label, string calldata subdomain) external payable; }
query
function query(bytes32 label, string calldata subdomain) external view returns (string memory domain, uint signupFee, uint rent, uint referralFeePPM);
// InterfaceID of these four methods is 0xc1b15f5a
LineComment
v0.5.16+commit.9c3226ce
None
bzzr://8751e27803ad5386d933139faf690ecb1e80c3045ffede7816138b0531f8d76b
{ "func_code_index": [ 517, 672 ] }
2,390
DMGYieldFarmingRouter
contracts/external/farming/v1/IDMGYieldFarmingV1.sol
0x85455fc1428ceee0072309f87a227d53783ba6a8
Solidity
IDMGYieldFarmingV1
interface IDMGYieldFarmingV1 { // //////////////////// // Events // //////////////////// event GlobalProxySet(address indexed proxy, bool isTrusted); event TokenAdded(address indexed token, address indexed underlyingToken, uint8 underlyingTokenDecimals, uint16 points); event TokenRemoved(address indexed token); event FarmSeasonBegun(uint indexed seasonIndex, uint dmgAmount); event FarmSeasonEnd(uint indexed seasonIndex, address dustRecipient, uint dustyDmgAmount); event DmgGrowthCoefficientSet(uint coefficient); event RewardPointsSet(address indexed token, uint16 points); event Approval(address indexed user, address indexed spender, bool isTrusted); event BeginFarming(address indexed owner, address indexed token, uint depositedAmount); event EndFarming(address indexed owner, address indexed token, uint withdrawnAmount, uint earnedDmgAmount); event WithdrawOutOfSeason(address indexed owner, address indexed token, address indexed recipient, uint amount); // //////////////////// // Admin Functions // //////////////////// /** * Sets the `proxy` as a trusted contract, allowing it to interact with the user, on the user's behalf. * * @param proxy The address that can interact on the user's behalf. * @param isTrusted True if the proxy is trusted or false if it's not (should be removed). */ function approveGloballyTrustedProxy(address proxy, bool isTrusted) external; /** * @return true if the provided `proxy` is globally trusted and may interact with the yield farming contract on a * user's behalf or false otherwise. */ function isGloballyTrustedProxy(address proxy) external view returns (bool); /** * @param token The address of the token to be supported for farming. * @param underlyingToken The token to which this token is pegged. IE a Uniswap-V2 LP equity token for * DAI-mDAI has an underlying token of DAI. * @param underlyingTokenDecimals The number of decimals that the `underlyingToken` has. * @param points The amount of reward points for the provided token. */ function addAllowableToken(address token, address underlyingToken, uint8 underlyingTokenDecimals, uint16 points) external; /** * @param token The address of the token that will be removed from farming. */ function removeAllowableToken(address token) external; /** * Changes the reward points for the provided token. Reward points are a weighting system that enables certain * tokens to accrue DMG faster than others, allowing the protocol to prioritize certain deposits. */ function setRewardPointsByToken(address token, uint16 points) external; /** * Sets the DMG growth coefficient to use the new parameter provided. This variable is used to define how much * DMG is earned every second, for each point accrued. */ function setDmgGrowthCoefficient(uint dmgGrowthCoefficient) external; /** * Begins the farming process so users that accumulate DMG by locking tokens can start for this rotation. Calling * this function increments the currentSeasonIndex, starting a new season. This function reverts if there is * already an active season. * * @param dmgAmount The amount of DMG that will be used to fund this campaign. */ function beginFarmingSeason(uint dmgAmount) external; /** * Ends the active farming process if the admin calls this function. Otherwise, anyone may call this function once * all DMG have been drained from the contract. * * @param dustRecipient The recipient of any leftover DMG in this contract, when the campaign finishes. */ function endActiveFarmingSeason(address dustRecipient) external; // //////////////////// // Misc Functions // //////////////////// /** * @return The tokens that the farm supports. */ function getFarmTokens() external view returns (address[] memory); /** * @return True if the provided token is supported for farming, or false if it's not. */ function isSupportedToken(address token) external view returns (bool); /** * @return True if there is an active season for farming, or false if there isn't one. */ function isFarmActive() external view returns (bool); /** * The address that acts as a "secondary" owner with quicker access to function calling than the owner. Typically, * this is the DMMF. */ function guardian() external view returns (address); /** * @return The DMG token. */ function dmgToken() external view returns (address); /** * @return The growth coefficient for earning DMG while farming. Each unit represents how much DMG is earned per * point */ function dmgGrowthCoefficient() external view returns (uint); /** * @return The amount of points that the provided token earns for each unit of token deposited. Defaults to `1` * if the provided `token` does not exist or does not have a special weight. This number is `2` decimals. */ function getRewardPointsByToken(address token) external view returns (uint16); /** * @return The number of decimals that the underlying token has. */ function getTokenDecimalsByToken(address token) external view returns (uint8); /** * @return The index into the array returned from `getFarmTokens`, plus 1. 0 if the token isn't found. If the * index returned is non-zero, subtract 1 from it to get the real index into the array. */ function getTokenIndexPlusOneByToken(address token) external view returns (uint); // //////////////////// // User Functions // //////////////////// /** * Approves the spender from `msg.sender` to transfer funds into the contract on the user's behalf. If `isTrusted` * is marked as false, removes the spender. */ function approve(address spender, bool isTrusted) external; /** * True if the `spender` can transfer tokens on the user's behalf to this contract. */ function isApproved(address user, address spender) external view returns (bool); /** * Begins a farm by transferring `amount` of `token` from `user` to this contract and adds it to the balance of * `user`. `user` must be either 1) msg.sender or 2) a wallet who has approved msg.sender as a proxy; else this * function reverts. `funder` must fit into the same criteria as `user`; else this function reverts */ function beginFarming(address user, address funder, address token, uint amount) external; /** * Ends a farm by transferring all of `token` deposited by `from` to `recipient`, from this contract, as well as * all earned DMG for farming `token` to `recipient`. `from` must be either 1) msg.sender or 2) an approved * proxy; else this function reverts. * * @return The amount of `token` withdrawn and the amount of DMG earned for farming. Both values are sent to * `recipient`. */ function endFarmingByToken(address from, address recipient, address token) external returns (uint, uint); /** * Withdraws all of `msg.sender`'s tokens from the farm to `recipient`. This function reverts if there is an active * farm. `user` must be either 1) msg.sender or 2) an approved proxy; else this function reverts. */ function withdrawAllWhenOutOfSeason(address user, address recipient) external; /** * Withdraws all of `user` `token` from the farm to `recipient`. This function reverts if there is an active farm and the token is NOT removed. * `user` must be either 1) msg.sender or 2) an approved proxy; else this function reverts. * * @return The amount of tokens sent to `recipient` */ function withdrawByTokenWhenOutOfSeason( address user, address recipient, address token ) external returns (uint); /** * @return The amount of DMG that this owner has earned in the active farm. If there are no active season, this * function returns `0`. */ function getRewardBalanceByOwner(address owner) external view returns (uint); /** * @return The amount of DMG that this owner has earned in the active farm for the provided token. If there is no * active season, this function returns `0`. */ function getRewardBalanceByOwnerAndToken(address owner, address token) external view returns (uint); /** * @return The amount of `token` that this owner has deposited into this contract. The user may withdraw this * non-zero balance by invoking `endFarming` or `endFarmingByToken` if there is an active farm. If there is * NO active farm, the user may withdraw his/her funds by invoking */ function balanceOf(address owner, address token) external view returns (uint); /** * @return The most recent timestamp at which the `owner` deposited `token` into the yield farming contract for * the current season. If there is no active season, this function returns `0`. */ function getMostRecentDepositTimestampByOwnerAndToken(address owner, address token) external view returns (uint64); /** * @return The most recent indexed amount of DMG earned by the `owner` for the deposited `token` which is being * farmed for the most-recent season. If there is no active season, this function returns `0`. */ function getMostRecentIndexedDmgEarnedByOwnerAndToken(address owner, address token) external view returns (uint); }
/** * The interface for DMG "Yield Farming" - A process through which users may earn DMG by locking up their mTokens in * Uniswap pools, and staking the Uniswap pool's equity token in this contract. * * Yield farming in the DMM Ecosystem entails "rotation periods" in which a season is active, in order to incentivize * deposits of underlying tokens into the protocol. */
NatSpecMultiLine
approveGloballyTrustedProxy
function approveGloballyTrustedProxy(address proxy, bool isTrusted) external;
/** * Sets the `proxy` as a trusted contract, allowing it to interact with the user, on the user's behalf. * * @param proxy The address that can interact on the user's behalf. * @param isTrusted True if the proxy is trusted or false if it's not (should be removed). */
NatSpecMultiLine
v0.5.13+commit.5b0b510c
Apache-2.0
bzzr://109d8c35d03b8ade3d7a4b4f689a030d34e0cce256c34dbd0f4a6b95b7701a2e
{ "func_code_index": [ 1448, 1530 ] }
2,391
DMGYieldFarmingRouter
contracts/external/farming/v1/IDMGYieldFarmingV1.sol
0x85455fc1428ceee0072309f87a227d53783ba6a8
Solidity
IDMGYieldFarmingV1
interface IDMGYieldFarmingV1 { // //////////////////// // Events // //////////////////// event GlobalProxySet(address indexed proxy, bool isTrusted); event TokenAdded(address indexed token, address indexed underlyingToken, uint8 underlyingTokenDecimals, uint16 points); event TokenRemoved(address indexed token); event FarmSeasonBegun(uint indexed seasonIndex, uint dmgAmount); event FarmSeasonEnd(uint indexed seasonIndex, address dustRecipient, uint dustyDmgAmount); event DmgGrowthCoefficientSet(uint coefficient); event RewardPointsSet(address indexed token, uint16 points); event Approval(address indexed user, address indexed spender, bool isTrusted); event BeginFarming(address indexed owner, address indexed token, uint depositedAmount); event EndFarming(address indexed owner, address indexed token, uint withdrawnAmount, uint earnedDmgAmount); event WithdrawOutOfSeason(address indexed owner, address indexed token, address indexed recipient, uint amount); // //////////////////// // Admin Functions // //////////////////// /** * Sets the `proxy` as a trusted contract, allowing it to interact with the user, on the user's behalf. * * @param proxy The address that can interact on the user's behalf. * @param isTrusted True if the proxy is trusted or false if it's not (should be removed). */ function approveGloballyTrustedProxy(address proxy, bool isTrusted) external; /** * @return true if the provided `proxy` is globally trusted and may interact with the yield farming contract on a * user's behalf or false otherwise. */ function isGloballyTrustedProxy(address proxy) external view returns (bool); /** * @param token The address of the token to be supported for farming. * @param underlyingToken The token to which this token is pegged. IE a Uniswap-V2 LP equity token for * DAI-mDAI has an underlying token of DAI. * @param underlyingTokenDecimals The number of decimals that the `underlyingToken` has. * @param points The amount of reward points for the provided token. */ function addAllowableToken(address token, address underlyingToken, uint8 underlyingTokenDecimals, uint16 points) external; /** * @param token The address of the token that will be removed from farming. */ function removeAllowableToken(address token) external; /** * Changes the reward points for the provided token. Reward points are a weighting system that enables certain * tokens to accrue DMG faster than others, allowing the protocol to prioritize certain deposits. */ function setRewardPointsByToken(address token, uint16 points) external; /** * Sets the DMG growth coefficient to use the new parameter provided. This variable is used to define how much * DMG is earned every second, for each point accrued. */ function setDmgGrowthCoefficient(uint dmgGrowthCoefficient) external; /** * Begins the farming process so users that accumulate DMG by locking tokens can start for this rotation. Calling * this function increments the currentSeasonIndex, starting a new season. This function reverts if there is * already an active season. * * @param dmgAmount The amount of DMG that will be used to fund this campaign. */ function beginFarmingSeason(uint dmgAmount) external; /** * Ends the active farming process if the admin calls this function. Otherwise, anyone may call this function once * all DMG have been drained from the contract. * * @param dustRecipient The recipient of any leftover DMG in this contract, when the campaign finishes. */ function endActiveFarmingSeason(address dustRecipient) external; // //////////////////// // Misc Functions // //////////////////// /** * @return The tokens that the farm supports. */ function getFarmTokens() external view returns (address[] memory); /** * @return True if the provided token is supported for farming, or false if it's not. */ function isSupportedToken(address token) external view returns (bool); /** * @return True if there is an active season for farming, or false if there isn't one. */ function isFarmActive() external view returns (bool); /** * The address that acts as a "secondary" owner with quicker access to function calling than the owner. Typically, * this is the DMMF. */ function guardian() external view returns (address); /** * @return The DMG token. */ function dmgToken() external view returns (address); /** * @return The growth coefficient for earning DMG while farming. Each unit represents how much DMG is earned per * point */ function dmgGrowthCoefficient() external view returns (uint); /** * @return The amount of points that the provided token earns for each unit of token deposited. Defaults to `1` * if the provided `token` does not exist or does not have a special weight. This number is `2` decimals. */ function getRewardPointsByToken(address token) external view returns (uint16); /** * @return The number of decimals that the underlying token has. */ function getTokenDecimalsByToken(address token) external view returns (uint8); /** * @return The index into the array returned from `getFarmTokens`, plus 1. 0 if the token isn't found. If the * index returned is non-zero, subtract 1 from it to get the real index into the array. */ function getTokenIndexPlusOneByToken(address token) external view returns (uint); // //////////////////// // User Functions // //////////////////// /** * Approves the spender from `msg.sender` to transfer funds into the contract on the user's behalf. If `isTrusted` * is marked as false, removes the spender. */ function approve(address spender, bool isTrusted) external; /** * True if the `spender` can transfer tokens on the user's behalf to this contract. */ function isApproved(address user, address spender) external view returns (bool); /** * Begins a farm by transferring `amount` of `token` from `user` to this contract and adds it to the balance of * `user`. `user` must be either 1) msg.sender or 2) a wallet who has approved msg.sender as a proxy; else this * function reverts. `funder` must fit into the same criteria as `user`; else this function reverts */ function beginFarming(address user, address funder, address token, uint amount) external; /** * Ends a farm by transferring all of `token` deposited by `from` to `recipient`, from this contract, as well as * all earned DMG for farming `token` to `recipient`. `from` must be either 1) msg.sender or 2) an approved * proxy; else this function reverts. * * @return The amount of `token` withdrawn and the amount of DMG earned for farming. Both values are sent to * `recipient`. */ function endFarmingByToken(address from, address recipient, address token) external returns (uint, uint); /** * Withdraws all of `msg.sender`'s tokens from the farm to `recipient`. This function reverts if there is an active * farm. `user` must be either 1) msg.sender or 2) an approved proxy; else this function reverts. */ function withdrawAllWhenOutOfSeason(address user, address recipient) external; /** * Withdraws all of `user` `token` from the farm to `recipient`. This function reverts if there is an active farm and the token is NOT removed. * `user` must be either 1) msg.sender or 2) an approved proxy; else this function reverts. * * @return The amount of tokens sent to `recipient` */ function withdrawByTokenWhenOutOfSeason( address user, address recipient, address token ) external returns (uint); /** * @return The amount of DMG that this owner has earned in the active farm. If there are no active season, this * function returns `0`. */ function getRewardBalanceByOwner(address owner) external view returns (uint); /** * @return The amount of DMG that this owner has earned in the active farm for the provided token. If there is no * active season, this function returns `0`. */ function getRewardBalanceByOwnerAndToken(address owner, address token) external view returns (uint); /** * @return The amount of `token` that this owner has deposited into this contract. The user may withdraw this * non-zero balance by invoking `endFarming` or `endFarmingByToken` if there is an active farm. If there is * NO active farm, the user may withdraw his/her funds by invoking */ function balanceOf(address owner, address token) external view returns (uint); /** * @return The most recent timestamp at which the `owner` deposited `token` into the yield farming contract for * the current season. If there is no active season, this function returns `0`. */ function getMostRecentDepositTimestampByOwnerAndToken(address owner, address token) external view returns (uint64); /** * @return The most recent indexed amount of DMG earned by the `owner` for the deposited `token` which is being * farmed for the most-recent season. If there is no active season, this function returns `0`. */ function getMostRecentIndexedDmgEarnedByOwnerAndToken(address owner, address token) external view returns (uint); }
/** * The interface for DMG "Yield Farming" - A process through which users may earn DMG by locking up their mTokens in * Uniswap pools, and staking the Uniswap pool's equity token in this contract. * * Yield farming in the DMM Ecosystem entails "rotation periods" in which a season is active, in order to incentivize * deposits of underlying tokens into the protocol. */
NatSpecMultiLine
isGloballyTrustedProxy
function isGloballyTrustedProxy(address proxy) external view returns (bool);
/** * @return true if the provided `proxy` is globally trusted and may interact with the yield farming contract on a * user's behalf or false otherwise. */
NatSpecMultiLine
v0.5.13+commit.5b0b510c
Apache-2.0
bzzr://109d8c35d03b8ade3d7a4b4f689a030d34e0cce256c34dbd0f4a6b95b7701a2e
{ "func_code_index": [ 1722, 1803 ] }
2,392
DMGYieldFarmingRouter
contracts/external/farming/v1/IDMGYieldFarmingV1.sol
0x85455fc1428ceee0072309f87a227d53783ba6a8
Solidity
IDMGYieldFarmingV1
interface IDMGYieldFarmingV1 { // //////////////////// // Events // //////////////////// event GlobalProxySet(address indexed proxy, bool isTrusted); event TokenAdded(address indexed token, address indexed underlyingToken, uint8 underlyingTokenDecimals, uint16 points); event TokenRemoved(address indexed token); event FarmSeasonBegun(uint indexed seasonIndex, uint dmgAmount); event FarmSeasonEnd(uint indexed seasonIndex, address dustRecipient, uint dustyDmgAmount); event DmgGrowthCoefficientSet(uint coefficient); event RewardPointsSet(address indexed token, uint16 points); event Approval(address indexed user, address indexed spender, bool isTrusted); event BeginFarming(address indexed owner, address indexed token, uint depositedAmount); event EndFarming(address indexed owner, address indexed token, uint withdrawnAmount, uint earnedDmgAmount); event WithdrawOutOfSeason(address indexed owner, address indexed token, address indexed recipient, uint amount); // //////////////////// // Admin Functions // //////////////////// /** * Sets the `proxy` as a trusted contract, allowing it to interact with the user, on the user's behalf. * * @param proxy The address that can interact on the user's behalf. * @param isTrusted True if the proxy is trusted or false if it's not (should be removed). */ function approveGloballyTrustedProxy(address proxy, bool isTrusted) external; /** * @return true if the provided `proxy` is globally trusted and may interact with the yield farming contract on a * user's behalf or false otherwise. */ function isGloballyTrustedProxy(address proxy) external view returns (bool); /** * @param token The address of the token to be supported for farming. * @param underlyingToken The token to which this token is pegged. IE a Uniswap-V2 LP equity token for * DAI-mDAI has an underlying token of DAI. * @param underlyingTokenDecimals The number of decimals that the `underlyingToken` has. * @param points The amount of reward points for the provided token. */ function addAllowableToken(address token, address underlyingToken, uint8 underlyingTokenDecimals, uint16 points) external; /** * @param token The address of the token that will be removed from farming. */ function removeAllowableToken(address token) external; /** * Changes the reward points for the provided token. Reward points are a weighting system that enables certain * tokens to accrue DMG faster than others, allowing the protocol to prioritize certain deposits. */ function setRewardPointsByToken(address token, uint16 points) external; /** * Sets the DMG growth coefficient to use the new parameter provided. This variable is used to define how much * DMG is earned every second, for each point accrued. */ function setDmgGrowthCoefficient(uint dmgGrowthCoefficient) external; /** * Begins the farming process so users that accumulate DMG by locking tokens can start for this rotation. Calling * this function increments the currentSeasonIndex, starting a new season. This function reverts if there is * already an active season. * * @param dmgAmount The amount of DMG that will be used to fund this campaign. */ function beginFarmingSeason(uint dmgAmount) external; /** * Ends the active farming process if the admin calls this function. Otherwise, anyone may call this function once * all DMG have been drained from the contract. * * @param dustRecipient The recipient of any leftover DMG in this contract, when the campaign finishes. */ function endActiveFarmingSeason(address dustRecipient) external; // //////////////////// // Misc Functions // //////////////////// /** * @return The tokens that the farm supports. */ function getFarmTokens() external view returns (address[] memory); /** * @return True if the provided token is supported for farming, or false if it's not. */ function isSupportedToken(address token) external view returns (bool); /** * @return True if there is an active season for farming, or false if there isn't one. */ function isFarmActive() external view returns (bool); /** * The address that acts as a "secondary" owner with quicker access to function calling than the owner. Typically, * this is the DMMF. */ function guardian() external view returns (address); /** * @return The DMG token. */ function dmgToken() external view returns (address); /** * @return The growth coefficient for earning DMG while farming. Each unit represents how much DMG is earned per * point */ function dmgGrowthCoefficient() external view returns (uint); /** * @return The amount of points that the provided token earns for each unit of token deposited. Defaults to `1` * if the provided `token` does not exist or does not have a special weight. This number is `2` decimals. */ function getRewardPointsByToken(address token) external view returns (uint16); /** * @return The number of decimals that the underlying token has. */ function getTokenDecimalsByToken(address token) external view returns (uint8); /** * @return The index into the array returned from `getFarmTokens`, plus 1. 0 if the token isn't found. If the * index returned is non-zero, subtract 1 from it to get the real index into the array. */ function getTokenIndexPlusOneByToken(address token) external view returns (uint); // //////////////////// // User Functions // //////////////////// /** * Approves the spender from `msg.sender` to transfer funds into the contract on the user's behalf. If `isTrusted` * is marked as false, removes the spender. */ function approve(address spender, bool isTrusted) external; /** * True if the `spender` can transfer tokens on the user's behalf to this contract. */ function isApproved(address user, address spender) external view returns (bool); /** * Begins a farm by transferring `amount` of `token` from `user` to this contract and adds it to the balance of * `user`. `user` must be either 1) msg.sender or 2) a wallet who has approved msg.sender as a proxy; else this * function reverts. `funder` must fit into the same criteria as `user`; else this function reverts */ function beginFarming(address user, address funder, address token, uint amount) external; /** * Ends a farm by transferring all of `token` deposited by `from` to `recipient`, from this contract, as well as * all earned DMG for farming `token` to `recipient`. `from` must be either 1) msg.sender or 2) an approved * proxy; else this function reverts. * * @return The amount of `token` withdrawn and the amount of DMG earned for farming. Both values are sent to * `recipient`. */ function endFarmingByToken(address from, address recipient, address token) external returns (uint, uint); /** * Withdraws all of `msg.sender`'s tokens from the farm to `recipient`. This function reverts if there is an active * farm. `user` must be either 1) msg.sender or 2) an approved proxy; else this function reverts. */ function withdrawAllWhenOutOfSeason(address user, address recipient) external; /** * Withdraws all of `user` `token` from the farm to `recipient`. This function reverts if there is an active farm and the token is NOT removed. * `user` must be either 1) msg.sender or 2) an approved proxy; else this function reverts. * * @return The amount of tokens sent to `recipient` */ function withdrawByTokenWhenOutOfSeason( address user, address recipient, address token ) external returns (uint); /** * @return The amount of DMG that this owner has earned in the active farm. If there are no active season, this * function returns `0`. */ function getRewardBalanceByOwner(address owner) external view returns (uint); /** * @return The amount of DMG that this owner has earned in the active farm for the provided token. If there is no * active season, this function returns `0`. */ function getRewardBalanceByOwnerAndToken(address owner, address token) external view returns (uint); /** * @return The amount of `token` that this owner has deposited into this contract. The user may withdraw this * non-zero balance by invoking `endFarming` or `endFarmingByToken` if there is an active farm. If there is * NO active farm, the user may withdraw his/her funds by invoking */ function balanceOf(address owner, address token) external view returns (uint); /** * @return The most recent timestamp at which the `owner` deposited `token` into the yield farming contract for * the current season. If there is no active season, this function returns `0`. */ function getMostRecentDepositTimestampByOwnerAndToken(address owner, address token) external view returns (uint64); /** * @return The most recent indexed amount of DMG earned by the `owner` for the deposited `token` which is being * farmed for the most-recent season. If there is no active season, this function returns `0`. */ function getMostRecentIndexedDmgEarnedByOwnerAndToken(address owner, address token) external view returns (uint); }
/** * The interface for DMG "Yield Farming" - A process through which users may earn DMG by locking up their mTokens in * Uniswap pools, and staking the Uniswap pool's equity token in this contract. * * Yield farming in the DMM Ecosystem entails "rotation periods" in which a season is active, in order to incentivize * deposits of underlying tokens into the protocol. */
NatSpecMultiLine
addAllowableToken
function addAllowableToken(address token, address underlyingToken, uint8 underlyingTokenDecimals, uint16 points) external;
/** * @param token The address of the token to be supported for farming. * @param underlyingToken The token to which this token is pegged. IE a Uniswap-V2 LP equity token for * DAI-mDAI has an underlying token of DAI. * @param underlyingTokenDecimals The number of decimals that the `underlyingToken` has. * @param points The amount of reward points for the provided token. */
NatSpecMultiLine
v0.5.13+commit.5b0b510c
Apache-2.0
bzzr://109d8c35d03b8ade3d7a4b4f689a030d34e0cce256c34dbd0f4a6b95b7701a2e
{ "func_code_index": [ 2308, 2435 ] }
2,393
DMGYieldFarmingRouter
contracts/external/farming/v1/IDMGYieldFarmingV1.sol
0x85455fc1428ceee0072309f87a227d53783ba6a8
Solidity
IDMGYieldFarmingV1
interface IDMGYieldFarmingV1 { // //////////////////// // Events // //////////////////// event GlobalProxySet(address indexed proxy, bool isTrusted); event TokenAdded(address indexed token, address indexed underlyingToken, uint8 underlyingTokenDecimals, uint16 points); event TokenRemoved(address indexed token); event FarmSeasonBegun(uint indexed seasonIndex, uint dmgAmount); event FarmSeasonEnd(uint indexed seasonIndex, address dustRecipient, uint dustyDmgAmount); event DmgGrowthCoefficientSet(uint coefficient); event RewardPointsSet(address indexed token, uint16 points); event Approval(address indexed user, address indexed spender, bool isTrusted); event BeginFarming(address indexed owner, address indexed token, uint depositedAmount); event EndFarming(address indexed owner, address indexed token, uint withdrawnAmount, uint earnedDmgAmount); event WithdrawOutOfSeason(address indexed owner, address indexed token, address indexed recipient, uint amount); // //////////////////// // Admin Functions // //////////////////// /** * Sets the `proxy` as a trusted contract, allowing it to interact with the user, on the user's behalf. * * @param proxy The address that can interact on the user's behalf. * @param isTrusted True if the proxy is trusted or false if it's not (should be removed). */ function approveGloballyTrustedProxy(address proxy, bool isTrusted) external; /** * @return true if the provided `proxy` is globally trusted and may interact with the yield farming contract on a * user's behalf or false otherwise. */ function isGloballyTrustedProxy(address proxy) external view returns (bool); /** * @param token The address of the token to be supported for farming. * @param underlyingToken The token to which this token is pegged. IE a Uniswap-V2 LP equity token for * DAI-mDAI has an underlying token of DAI. * @param underlyingTokenDecimals The number of decimals that the `underlyingToken` has. * @param points The amount of reward points for the provided token. */ function addAllowableToken(address token, address underlyingToken, uint8 underlyingTokenDecimals, uint16 points) external; /** * @param token The address of the token that will be removed from farming. */ function removeAllowableToken(address token) external; /** * Changes the reward points for the provided token. Reward points are a weighting system that enables certain * tokens to accrue DMG faster than others, allowing the protocol to prioritize certain deposits. */ function setRewardPointsByToken(address token, uint16 points) external; /** * Sets the DMG growth coefficient to use the new parameter provided. This variable is used to define how much * DMG is earned every second, for each point accrued. */ function setDmgGrowthCoefficient(uint dmgGrowthCoefficient) external; /** * Begins the farming process so users that accumulate DMG by locking tokens can start for this rotation. Calling * this function increments the currentSeasonIndex, starting a new season. This function reverts if there is * already an active season. * * @param dmgAmount The amount of DMG that will be used to fund this campaign. */ function beginFarmingSeason(uint dmgAmount) external; /** * Ends the active farming process if the admin calls this function. Otherwise, anyone may call this function once * all DMG have been drained from the contract. * * @param dustRecipient The recipient of any leftover DMG in this contract, when the campaign finishes. */ function endActiveFarmingSeason(address dustRecipient) external; // //////////////////// // Misc Functions // //////////////////// /** * @return The tokens that the farm supports. */ function getFarmTokens() external view returns (address[] memory); /** * @return True if the provided token is supported for farming, or false if it's not. */ function isSupportedToken(address token) external view returns (bool); /** * @return True if there is an active season for farming, or false if there isn't one. */ function isFarmActive() external view returns (bool); /** * The address that acts as a "secondary" owner with quicker access to function calling than the owner. Typically, * this is the DMMF. */ function guardian() external view returns (address); /** * @return The DMG token. */ function dmgToken() external view returns (address); /** * @return The growth coefficient for earning DMG while farming. Each unit represents how much DMG is earned per * point */ function dmgGrowthCoefficient() external view returns (uint); /** * @return The amount of points that the provided token earns for each unit of token deposited. Defaults to `1` * if the provided `token` does not exist or does not have a special weight. This number is `2` decimals. */ function getRewardPointsByToken(address token) external view returns (uint16); /** * @return The number of decimals that the underlying token has. */ function getTokenDecimalsByToken(address token) external view returns (uint8); /** * @return The index into the array returned from `getFarmTokens`, plus 1. 0 if the token isn't found. If the * index returned is non-zero, subtract 1 from it to get the real index into the array. */ function getTokenIndexPlusOneByToken(address token) external view returns (uint); // //////////////////// // User Functions // //////////////////// /** * Approves the spender from `msg.sender` to transfer funds into the contract on the user's behalf. If `isTrusted` * is marked as false, removes the spender. */ function approve(address spender, bool isTrusted) external; /** * True if the `spender` can transfer tokens on the user's behalf to this contract. */ function isApproved(address user, address spender) external view returns (bool); /** * Begins a farm by transferring `amount` of `token` from `user` to this contract and adds it to the balance of * `user`. `user` must be either 1) msg.sender or 2) a wallet who has approved msg.sender as a proxy; else this * function reverts. `funder` must fit into the same criteria as `user`; else this function reverts */ function beginFarming(address user, address funder, address token, uint amount) external; /** * Ends a farm by transferring all of `token` deposited by `from` to `recipient`, from this contract, as well as * all earned DMG for farming `token` to `recipient`. `from` must be either 1) msg.sender or 2) an approved * proxy; else this function reverts. * * @return The amount of `token` withdrawn and the amount of DMG earned for farming. Both values are sent to * `recipient`. */ function endFarmingByToken(address from, address recipient, address token) external returns (uint, uint); /** * Withdraws all of `msg.sender`'s tokens from the farm to `recipient`. This function reverts if there is an active * farm. `user` must be either 1) msg.sender or 2) an approved proxy; else this function reverts. */ function withdrawAllWhenOutOfSeason(address user, address recipient) external; /** * Withdraws all of `user` `token` from the farm to `recipient`. This function reverts if there is an active farm and the token is NOT removed. * `user` must be either 1) msg.sender or 2) an approved proxy; else this function reverts. * * @return The amount of tokens sent to `recipient` */ function withdrawByTokenWhenOutOfSeason( address user, address recipient, address token ) external returns (uint); /** * @return The amount of DMG that this owner has earned in the active farm. If there are no active season, this * function returns `0`. */ function getRewardBalanceByOwner(address owner) external view returns (uint); /** * @return The amount of DMG that this owner has earned in the active farm for the provided token. If there is no * active season, this function returns `0`. */ function getRewardBalanceByOwnerAndToken(address owner, address token) external view returns (uint); /** * @return The amount of `token` that this owner has deposited into this contract. The user may withdraw this * non-zero balance by invoking `endFarming` or `endFarmingByToken` if there is an active farm. If there is * NO active farm, the user may withdraw his/her funds by invoking */ function balanceOf(address owner, address token) external view returns (uint); /** * @return The most recent timestamp at which the `owner` deposited `token` into the yield farming contract for * the current season. If there is no active season, this function returns `0`. */ function getMostRecentDepositTimestampByOwnerAndToken(address owner, address token) external view returns (uint64); /** * @return The most recent indexed amount of DMG earned by the `owner` for the deposited `token` which is being * farmed for the most-recent season. If there is no active season, this function returns `0`. */ function getMostRecentIndexedDmgEarnedByOwnerAndToken(address owner, address token) external view returns (uint); }
/** * The interface for DMG "Yield Farming" - A process through which users may earn DMG by locking up their mTokens in * Uniswap pools, and staking the Uniswap pool's equity token in this contract. * * Yield farming in the DMM Ecosystem entails "rotation periods" in which a season is active, in order to incentivize * deposits of underlying tokens into the protocol. */
NatSpecMultiLine
removeAllowableToken
function removeAllowableToken(address token) external;
/** * @param token The address of the token that will be removed from farming. */
NatSpecMultiLine
v0.5.13+commit.5b0b510c
Apache-2.0
bzzr://109d8c35d03b8ade3d7a4b4f689a030d34e0cce256c34dbd0f4a6b95b7701a2e
{ "func_code_index": [ 2541, 2600 ] }
2,394
DMGYieldFarmingRouter
contracts/external/farming/v1/IDMGYieldFarmingV1.sol
0x85455fc1428ceee0072309f87a227d53783ba6a8
Solidity
IDMGYieldFarmingV1
interface IDMGYieldFarmingV1 { // //////////////////// // Events // //////////////////// event GlobalProxySet(address indexed proxy, bool isTrusted); event TokenAdded(address indexed token, address indexed underlyingToken, uint8 underlyingTokenDecimals, uint16 points); event TokenRemoved(address indexed token); event FarmSeasonBegun(uint indexed seasonIndex, uint dmgAmount); event FarmSeasonEnd(uint indexed seasonIndex, address dustRecipient, uint dustyDmgAmount); event DmgGrowthCoefficientSet(uint coefficient); event RewardPointsSet(address indexed token, uint16 points); event Approval(address indexed user, address indexed spender, bool isTrusted); event BeginFarming(address indexed owner, address indexed token, uint depositedAmount); event EndFarming(address indexed owner, address indexed token, uint withdrawnAmount, uint earnedDmgAmount); event WithdrawOutOfSeason(address indexed owner, address indexed token, address indexed recipient, uint amount); // //////////////////// // Admin Functions // //////////////////// /** * Sets the `proxy` as a trusted contract, allowing it to interact with the user, on the user's behalf. * * @param proxy The address that can interact on the user's behalf. * @param isTrusted True if the proxy is trusted or false if it's not (should be removed). */ function approveGloballyTrustedProxy(address proxy, bool isTrusted) external; /** * @return true if the provided `proxy` is globally trusted and may interact with the yield farming contract on a * user's behalf or false otherwise. */ function isGloballyTrustedProxy(address proxy) external view returns (bool); /** * @param token The address of the token to be supported for farming. * @param underlyingToken The token to which this token is pegged. IE a Uniswap-V2 LP equity token for * DAI-mDAI has an underlying token of DAI. * @param underlyingTokenDecimals The number of decimals that the `underlyingToken` has. * @param points The amount of reward points for the provided token. */ function addAllowableToken(address token, address underlyingToken, uint8 underlyingTokenDecimals, uint16 points) external; /** * @param token The address of the token that will be removed from farming. */ function removeAllowableToken(address token) external; /** * Changes the reward points for the provided token. Reward points are a weighting system that enables certain * tokens to accrue DMG faster than others, allowing the protocol to prioritize certain deposits. */ function setRewardPointsByToken(address token, uint16 points) external; /** * Sets the DMG growth coefficient to use the new parameter provided. This variable is used to define how much * DMG is earned every second, for each point accrued. */ function setDmgGrowthCoefficient(uint dmgGrowthCoefficient) external; /** * Begins the farming process so users that accumulate DMG by locking tokens can start for this rotation. Calling * this function increments the currentSeasonIndex, starting a new season. This function reverts if there is * already an active season. * * @param dmgAmount The amount of DMG that will be used to fund this campaign. */ function beginFarmingSeason(uint dmgAmount) external; /** * Ends the active farming process if the admin calls this function. Otherwise, anyone may call this function once * all DMG have been drained from the contract. * * @param dustRecipient The recipient of any leftover DMG in this contract, when the campaign finishes. */ function endActiveFarmingSeason(address dustRecipient) external; // //////////////////// // Misc Functions // //////////////////// /** * @return The tokens that the farm supports. */ function getFarmTokens() external view returns (address[] memory); /** * @return True if the provided token is supported for farming, or false if it's not. */ function isSupportedToken(address token) external view returns (bool); /** * @return True if there is an active season for farming, or false if there isn't one. */ function isFarmActive() external view returns (bool); /** * The address that acts as a "secondary" owner with quicker access to function calling than the owner. Typically, * this is the DMMF. */ function guardian() external view returns (address); /** * @return The DMG token. */ function dmgToken() external view returns (address); /** * @return The growth coefficient for earning DMG while farming. Each unit represents how much DMG is earned per * point */ function dmgGrowthCoefficient() external view returns (uint); /** * @return The amount of points that the provided token earns for each unit of token deposited. Defaults to `1` * if the provided `token` does not exist or does not have a special weight. This number is `2` decimals. */ function getRewardPointsByToken(address token) external view returns (uint16); /** * @return The number of decimals that the underlying token has. */ function getTokenDecimalsByToken(address token) external view returns (uint8); /** * @return The index into the array returned from `getFarmTokens`, plus 1. 0 if the token isn't found. If the * index returned is non-zero, subtract 1 from it to get the real index into the array. */ function getTokenIndexPlusOneByToken(address token) external view returns (uint); // //////////////////// // User Functions // //////////////////// /** * Approves the spender from `msg.sender` to transfer funds into the contract on the user's behalf. If `isTrusted` * is marked as false, removes the spender. */ function approve(address spender, bool isTrusted) external; /** * True if the `spender` can transfer tokens on the user's behalf to this contract. */ function isApproved(address user, address spender) external view returns (bool); /** * Begins a farm by transferring `amount` of `token` from `user` to this contract and adds it to the balance of * `user`. `user` must be either 1) msg.sender or 2) a wallet who has approved msg.sender as a proxy; else this * function reverts. `funder` must fit into the same criteria as `user`; else this function reverts */ function beginFarming(address user, address funder, address token, uint amount) external; /** * Ends a farm by transferring all of `token` deposited by `from` to `recipient`, from this contract, as well as * all earned DMG for farming `token` to `recipient`. `from` must be either 1) msg.sender or 2) an approved * proxy; else this function reverts. * * @return The amount of `token` withdrawn and the amount of DMG earned for farming. Both values are sent to * `recipient`. */ function endFarmingByToken(address from, address recipient, address token) external returns (uint, uint); /** * Withdraws all of `msg.sender`'s tokens from the farm to `recipient`. This function reverts if there is an active * farm. `user` must be either 1) msg.sender or 2) an approved proxy; else this function reverts. */ function withdrawAllWhenOutOfSeason(address user, address recipient) external; /** * Withdraws all of `user` `token` from the farm to `recipient`. This function reverts if there is an active farm and the token is NOT removed. * `user` must be either 1) msg.sender or 2) an approved proxy; else this function reverts. * * @return The amount of tokens sent to `recipient` */ function withdrawByTokenWhenOutOfSeason( address user, address recipient, address token ) external returns (uint); /** * @return The amount of DMG that this owner has earned in the active farm. If there are no active season, this * function returns `0`. */ function getRewardBalanceByOwner(address owner) external view returns (uint); /** * @return The amount of DMG that this owner has earned in the active farm for the provided token. If there is no * active season, this function returns `0`. */ function getRewardBalanceByOwnerAndToken(address owner, address token) external view returns (uint); /** * @return The amount of `token` that this owner has deposited into this contract. The user may withdraw this * non-zero balance by invoking `endFarming` or `endFarmingByToken` if there is an active farm. If there is * NO active farm, the user may withdraw his/her funds by invoking */ function balanceOf(address owner, address token) external view returns (uint); /** * @return The most recent timestamp at which the `owner` deposited `token` into the yield farming contract for * the current season. If there is no active season, this function returns `0`. */ function getMostRecentDepositTimestampByOwnerAndToken(address owner, address token) external view returns (uint64); /** * @return The most recent indexed amount of DMG earned by the `owner` for the deposited `token` which is being * farmed for the most-recent season. If there is no active season, this function returns `0`. */ function getMostRecentIndexedDmgEarnedByOwnerAndToken(address owner, address token) external view returns (uint); }
/** * The interface for DMG "Yield Farming" - A process through which users may earn DMG by locking up their mTokens in * Uniswap pools, and staking the Uniswap pool's equity token in this contract. * * Yield farming in the DMM Ecosystem entails "rotation periods" in which a season is active, in order to incentivize * deposits of underlying tokens into the protocol. */
NatSpecMultiLine
setRewardPointsByToken
function setRewardPointsByToken(address token, uint16 points) external;
/** * Changes the reward points for the provided token. Reward points are a weighting system that enables certain * tokens to accrue DMG faster than others, allowing the protocol to prioritize certain deposits. */
NatSpecMultiLine
v0.5.13+commit.5b0b510c
Apache-2.0
bzzr://109d8c35d03b8ade3d7a4b4f689a030d34e0cce256c34dbd0f4a6b95b7701a2e
{ "func_code_index": [ 2840, 2916 ] }
2,395
DMGYieldFarmingRouter
contracts/external/farming/v1/IDMGYieldFarmingV1.sol
0x85455fc1428ceee0072309f87a227d53783ba6a8
Solidity
IDMGYieldFarmingV1
interface IDMGYieldFarmingV1 { // //////////////////// // Events // //////////////////// event GlobalProxySet(address indexed proxy, bool isTrusted); event TokenAdded(address indexed token, address indexed underlyingToken, uint8 underlyingTokenDecimals, uint16 points); event TokenRemoved(address indexed token); event FarmSeasonBegun(uint indexed seasonIndex, uint dmgAmount); event FarmSeasonEnd(uint indexed seasonIndex, address dustRecipient, uint dustyDmgAmount); event DmgGrowthCoefficientSet(uint coefficient); event RewardPointsSet(address indexed token, uint16 points); event Approval(address indexed user, address indexed spender, bool isTrusted); event BeginFarming(address indexed owner, address indexed token, uint depositedAmount); event EndFarming(address indexed owner, address indexed token, uint withdrawnAmount, uint earnedDmgAmount); event WithdrawOutOfSeason(address indexed owner, address indexed token, address indexed recipient, uint amount); // //////////////////// // Admin Functions // //////////////////// /** * Sets the `proxy` as a trusted contract, allowing it to interact with the user, on the user's behalf. * * @param proxy The address that can interact on the user's behalf. * @param isTrusted True if the proxy is trusted or false if it's not (should be removed). */ function approveGloballyTrustedProxy(address proxy, bool isTrusted) external; /** * @return true if the provided `proxy` is globally trusted and may interact with the yield farming contract on a * user's behalf or false otherwise. */ function isGloballyTrustedProxy(address proxy) external view returns (bool); /** * @param token The address of the token to be supported for farming. * @param underlyingToken The token to which this token is pegged. IE a Uniswap-V2 LP equity token for * DAI-mDAI has an underlying token of DAI. * @param underlyingTokenDecimals The number of decimals that the `underlyingToken` has. * @param points The amount of reward points for the provided token. */ function addAllowableToken(address token, address underlyingToken, uint8 underlyingTokenDecimals, uint16 points) external; /** * @param token The address of the token that will be removed from farming. */ function removeAllowableToken(address token) external; /** * Changes the reward points for the provided token. Reward points are a weighting system that enables certain * tokens to accrue DMG faster than others, allowing the protocol to prioritize certain deposits. */ function setRewardPointsByToken(address token, uint16 points) external; /** * Sets the DMG growth coefficient to use the new parameter provided. This variable is used to define how much * DMG is earned every second, for each point accrued. */ function setDmgGrowthCoefficient(uint dmgGrowthCoefficient) external; /** * Begins the farming process so users that accumulate DMG by locking tokens can start for this rotation. Calling * this function increments the currentSeasonIndex, starting a new season. This function reverts if there is * already an active season. * * @param dmgAmount The amount of DMG that will be used to fund this campaign. */ function beginFarmingSeason(uint dmgAmount) external; /** * Ends the active farming process if the admin calls this function. Otherwise, anyone may call this function once * all DMG have been drained from the contract. * * @param dustRecipient The recipient of any leftover DMG in this contract, when the campaign finishes. */ function endActiveFarmingSeason(address dustRecipient) external; // //////////////////// // Misc Functions // //////////////////// /** * @return The tokens that the farm supports. */ function getFarmTokens() external view returns (address[] memory); /** * @return True if the provided token is supported for farming, or false if it's not. */ function isSupportedToken(address token) external view returns (bool); /** * @return True if there is an active season for farming, or false if there isn't one. */ function isFarmActive() external view returns (bool); /** * The address that acts as a "secondary" owner with quicker access to function calling than the owner. Typically, * this is the DMMF. */ function guardian() external view returns (address); /** * @return The DMG token. */ function dmgToken() external view returns (address); /** * @return The growth coefficient for earning DMG while farming. Each unit represents how much DMG is earned per * point */ function dmgGrowthCoefficient() external view returns (uint); /** * @return The amount of points that the provided token earns for each unit of token deposited. Defaults to `1` * if the provided `token` does not exist or does not have a special weight. This number is `2` decimals. */ function getRewardPointsByToken(address token) external view returns (uint16); /** * @return The number of decimals that the underlying token has. */ function getTokenDecimalsByToken(address token) external view returns (uint8); /** * @return The index into the array returned from `getFarmTokens`, plus 1. 0 if the token isn't found. If the * index returned is non-zero, subtract 1 from it to get the real index into the array. */ function getTokenIndexPlusOneByToken(address token) external view returns (uint); // //////////////////// // User Functions // //////////////////// /** * Approves the spender from `msg.sender` to transfer funds into the contract on the user's behalf. If `isTrusted` * is marked as false, removes the spender. */ function approve(address spender, bool isTrusted) external; /** * True if the `spender` can transfer tokens on the user's behalf to this contract. */ function isApproved(address user, address spender) external view returns (bool); /** * Begins a farm by transferring `amount` of `token` from `user` to this contract and adds it to the balance of * `user`. `user` must be either 1) msg.sender or 2) a wallet who has approved msg.sender as a proxy; else this * function reverts. `funder` must fit into the same criteria as `user`; else this function reverts */ function beginFarming(address user, address funder, address token, uint amount) external; /** * Ends a farm by transferring all of `token` deposited by `from` to `recipient`, from this contract, as well as * all earned DMG for farming `token` to `recipient`. `from` must be either 1) msg.sender or 2) an approved * proxy; else this function reverts. * * @return The amount of `token` withdrawn and the amount of DMG earned for farming. Both values are sent to * `recipient`. */ function endFarmingByToken(address from, address recipient, address token) external returns (uint, uint); /** * Withdraws all of `msg.sender`'s tokens from the farm to `recipient`. This function reverts if there is an active * farm. `user` must be either 1) msg.sender or 2) an approved proxy; else this function reverts. */ function withdrawAllWhenOutOfSeason(address user, address recipient) external; /** * Withdraws all of `user` `token` from the farm to `recipient`. This function reverts if there is an active farm and the token is NOT removed. * `user` must be either 1) msg.sender or 2) an approved proxy; else this function reverts. * * @return The amount of tokens sent to `recipient` */ function withdrawByTokenWhenOutOfSeason( address user, address recipient, address token ) external returns (uint); /** * @return The amount of DMG that this owner has earned in the active farm. If there are no active season, this * function returns `0`. */ function getRewardBalanceByOwner(address owner) external view returns (uint); /** * @return The amount of DMG that this owner has earned in the active farm for the provided token. If there is no * active season, this function returns `0`. */ function getRewardBalanceByOwnerAndToken(address owner, address token) external view returns (uint); /** * @return The amount of `token` that this owner has deposited into this contract. The user may withdraw this * non-zero balance by invoking `endFarming` or `endFarmingByToken` if there is an active farm. If there is * NO active farm, the user may withdraw his/her funds by invoking */ function balanceOf(address owner, address token) external view returns (uint); /** * @return The most recent timestamp at which the `owner` deposited `token` into the yield farming contract for * the current season. If there is no active season, this function returns `0`. */ function getMostRecentDepositTimestampByOwnerAndToken(address owner, address token) external view returns (uint64); /** * @return The most recent indexed amount of DMG earned by the `owner` for the deposited `token` which is being * farmed for the most-recent season. If there is no active season, this function returns `0`. */ function getMostRecentIndexedDmgEarnedByOwnerAndToken(address owner, address token) external view returns (uint); }
/** * The interface for DMG "Yield Farming" - A process through which users may earn DMG by locking up their mTokens in * Uniswap pools, and staking the Uniswap pool's equity token in this contract. * * Yield farming in the DMM Ecosystem entails "rotation periods" in which a season is active, in order to incentivize * deposits of underlying tokens into the protocol. */
NatSpecMultiLine
setDmgGrowthCoefficient
function setDmgGrowthCoefficient(uint dmgGrowthCoefficient) external;
/** * Sets the DMG growth coefficient to use the new parameter provided. This variable is used to define how much * DMG is earned every second, for each point accrued. */
NatSpecMultiLine
v0.5.13+commit.5b0b510c
Apache-2.0
bzzr://109d8c35d03b8ade3d7a4b4f689a030d34e0cce256c34dbd0f4a6b95b7701a2e
{ "func_code_index": [ 3113, 3187 ] }
2,396
DMGYieldFarmingRouter
contracts/external/farming/v1/IDMGYieldFarmingV1.sol
0x85455fc1428ceee0072309f87a227d53783ba6a8
Solidity
IDMGYieldFarmingV1
interface IDMGYieldFarmingV1 { // //////////////////// // Events // //////////////////// event GlobalProxySet(address indexed proxy, bool isTrusted); event TokenAdded(address indexed token, address indexed underlyingToken, uint8 underlyingTokenDecimals, uint16 points); event TokenRemoved(address indexed token); event FarmSeasonBegun(uint indexed seasonIndex, uint dmgAmount); event FarmSeasonEnd(uint indexed seasonIndex, address dustRecipient, uint dustyDmgAmount); event DmgGrowthCoefficientSet(uint coefficient); event RewardPointsSet(address indexed token, uint16 points); event Approval(address indexed user, address indexed spender, bool isTrusted); event BeginFarming(address indexed owner, address indexed token, uint depositedAmount); event EndFarming(address indexed owner, address indexed token, uint withdrawnAmount, uint earnedDmgAmount); event WithdrawOutOfSeason(address indexed owner, address indexed token, address indexed recipient, uint amount); // //////////////////// // Admin Functions // //////////////////// /** * Sets the `proxy` as a trusted contract, allowing it to interact with the user, on the user's behalf. * * @param proxy The address that can interact on the user's behalf. * @param isTrusted True if the proxy is trusted or false if it's not (should be removed). */ function approveGloballyTrustedProxy(address proxy, bool isTrusted) external; /** * @return true if the provided `proxy` is globally trusted and may interact with the yield farming contract on a * user's behalf or false otherwise. */ function isGloballyTrustedProxy(address proxy) external view returns (bool); /** * @param token The address of the token to be supported for farming. * @param underlyingToken The token to which this token is pegged. IE a Uniswap-V2 LP equity token for * DAI-mDAI has an underlying token of DAI. * @param underlyingTokenDecimals The number of decimals that the `underlyingToken` has. * @param points The amount of reward points for the provided token. */ function addAllowableToken(address token, address underlyingToken, uint8 underlyingTokenDecimals, uint16 points) external; /** * @param token The address of the token that will be removed from farming. */ function removeAllowableToken(address token) external; /** * Changes the reward points for the provided token. Reward points are a weighting system that enables certain * tokens to accrue DMG faster than others, allowing the protocol to prioritize certain deposits. */ function setRewardPointsByToken(address token, uint16 points) external; /** * Sets the DMG growth coefficient to use the new parameter provided. This variable is used to define how much * DMG is earned every second, for each point accrued. */ function setDmgGrowthCoefficient(uint dmgGrowthCoefficient) external; /** * Begins the farming process so users that accumulate DMG by locking tokens can start for this rotation. Calling * this function increments the currentSeasonIndex, starting a new season. This function reverts if there is * already an active season. * * @param dmgAmount The amount of DMG that will be used to fund this campaign. */ function beginFarmingSeason(uint dmgAmount) external; /** * Ends the active farming process if the admin calls this function. Otherwise, anyone may call this function once * all DMG have been drained from the contract. * * @param dustRecipient The recipient of any leftover DMG in this contract, when the campaign finishes. */ function endActiveFarmingSeason(address dustRecipient) external; // //////////////////// // Misc Functions // //////////////////// /** * @return The tokens that the farm supports. */ function getFarmTokens() external view returns (address[] memory); /** * @return True if the provided token is supported for farming, or false if it's not. */ function isSupportedToken(address token) external view returns (bool); /** * @return True if there is an active season for farming, or false if there isn't one. */ function isFarmActive() external view returns (bool); /** * The address that acts as a "secondary" owner with quicker access to function calling than the owner. Typically, * this is the DMMF. */ function guardian() external view returns (address); /** * @return The DMG token. */ function dmgToken() external view returns (address); /** * @return The growth coefficient for earning DMG while farming. Each unit represents how much DMG is earned per * point */ function dmgGrowthCoefficient() external view returns (uint); /** * @return The amount of points that the provided token earns for each unit of token deposited. Defaults to `1` * if the provided `token` does not exist or does not have a special weight. This number is `2` decimals. */ function getRewardPointsByToken(address token) external view returns (uint16); /** * @return The number of decimals that the underlying token has. */ function getTokenDecimalsByToken(address token) external view returns (uint8); /** * @return The index into the array returned from `getFarmTokens`, plus 1. 0 if the token isn't found. If the * index returned is non-zero, subtract 1 from it to get the real index into the array. */ function getTokenIndexPlusOneByToken(address token) external view returns (uint); // //////////////////// // User Functions // //////////////////// /** * Approves the spender from `msg.sender` to transfer funds into the contract on the user's behalf. If `isTrusted` * is marked as false, removes the spender. */ function approve(address spender, bool isTrusted) external; /** * True if the `spender` can transfer tokens on the user's behalf to this contract. */ function isApproved(address user, address spender) external view returns (bool); /** * Begins a farm by transferring `amount` of `token` from `user` to this contract and adds it to the balance of * `user`. `user` must be either 1) msg.sender or 2) a wallet who has approved msg.sender as a proxy; else this * function reverts. `funder` must fit into the same criteria as `user`; else this function reverts */ function beginFarming(address user, address funder, address token, uint amount) external; /** * Ends a farm by transferring all of `token` deposited by `from` to `recipient`, from this contract, as well as * all earned DMG for farming `token` to `recipient`. `from` must be either 1) msg.sender or 2) an approved * proxy; else this function reverts. * * @return The amount of `token` withdrawn and the amount of DMG earned for farming. Both values are sent to * `recipient`. */ function endFarmingByToken(address from, address recipient, address token) external returns (uint, uint); /** * Withdraws all of `msg.sender`'s tokens from the farm to `recipient`. This function reverts if there is an active * farm. `user` must be either 1) msg.sender or 2) an approved proxy; else this function reverts. */ function withdrawAllWhenOutOfSeason(address user, address recipient) external; /** * Withdraws all of `user` `token` from the farm to `recipient`. This function reverts if there is an active farm and the token is NOT removed. * `user` must be either 1) msg.sender or 2) an approved proxy; else this function reverts. * * @return The amount of tokens sent to `recipient` */ function withdrawByTokenWhenOutOfSeason( address user, address recipient, address token ) external returns (uint); /** * @return The amount of DMG that this owner has earned in the active farm. If there are no active season, this * function returns `0`. */ function getRewardBalanceByOwner(address owner) external view returns (uint); /** * @return The amount of DMG that this owner has earned in the active farm for the provided token. If there is no * active season, this function returns `0`. */ function getRewardBalanceByOwnerAndToken(address owner, address token) external view returns (uint); /** * @return The amount of `token` that this owner has deposited into this contract. The user may withdraw this * non-zero balance by invoking `endFarming` or `endFarmingByToken` if there is an active farm. If there is * NO active farm, the user may withdraw his/her funds by invoking */ function balanceOf(address owner, address token) external view returns (uint); /** * @return The most recent timestamp at which the `owner` deposited `token` into the yield farming contract for * the current season. If there is no active season, this function returns `0`. */ function getMostRecentDepositTimestampByOwnerAndToken(address owner, address token) external view returns (uint64); /** * @return The most recent indexed amount of DMG earned by the `owner` for the deposited `token` which is being * farmed for the most-recent season. If there is no active season, this function returns `0`. */ function getMostRecentIndexedDmgEarnedByOwnerAndToken(address owner, address token) external view returns (uint); }
/** * The interface for DMG "Yield Farming" - A process through which users may earn DMG by locking up their mTokens in * Uniswap pools, and staking the Uniswap pool's equity token in this contract. * * Yield farming in the DMM Ecosystem entails "rotation periods" in which a season is active, in order to incentivize * deposits of underlying tokens into the protocol. */
NatSpecMultiLine
beginFarmingSeason
function beginFarmingSeason(uint dmgAmount) external;
/** * Begins the farming process so users that accumulate DMG by locking tokens can start for this rotation. Calling * this function increments the currentSeasonIndex, starting a new season. This function reverts if there is * already an active season. * * @param dmgAmount The amount of DMG that will be used to fund this campaign. */
NatSpecMultiLine
v0.5.13+commit.5b0b510c
Apache-2.0
bzzr://109d8c35d03b8ade3d7a4b4f689a030d34e0cce256c34dbd0f4a6b95b7701a2e
{ "func_code_index": [ 3567, 3625 ] }
2,397
DMGYieldFarmingRouter
contracts/external/farming/v1/IDMGYieldFarmingV1.sol
0x85455fc1428ceee0072309f87a227d53783ba6a8
Solidity
IDMGYieldFarmingV1
interface IDMGYieldFarmingV1 { // //////////////////// // Events // //////////////////// event GlobalProxySet(address indexed proxy, bool isTrusted); event TokenAdded(address indexed token, address indexed underlyingToken, uint8 underlyingTokenDecimals, uint16 points); event TokenRemoved(address indexed token); event FarmSeasonBegun(uint indexed seasonIndex, uint dmgAmount); event FarmSeasonEnd(uint indexed seasonIndex, address dustRecipient, uint dustyDmgAmount); event DmgGrowthCoefficientSet(uint coefficient); event RewardPointsSet(address indexed token, uint16 points); event Approval(address indexed user, address indexed spender, bool isTrusted); event BeginFarming(address indexed owner, address indexed token, uint depositedAmount); event EndFarming(address indexed owner, address indexed token, uint withdrawnAmount, uint earnedDmgAmount); event WithdrawOutOfSeason(address indexed owner, address indexed token, address indexed recipient, uint amount); // //////////////////// // Admin Functions // //////////////////// /** * Sets the `proxy` as a trusted contract, allowing it to interact with the user, on the user's behalf. * * @param proxy The address that can interact on the user's behalf. * @param isTrusted True if the proxy is trusted or false if it's not (should be removed). */ function approveGloballyTrustedProxy(address proxy, bool isTrusted) external; /** * @return true if the provided `proxy` is globally trusted and may interact with the yield farming contract on a * user's behalf or false otherwise. */ function isGloballyTrustedProxy(address proxy) external view returns (bool); /** * @param token The address of the token to be supported for farming. * @param underlyingToken The token to which this token is pegged. IE a Uniswap-V2 LP equity token for * DAI-mDAI has an underlying token of DAI. * @param underlyingTokenDecimals The number of decimals that the `underlyingToken` has. * @param points The amount of reward points for the provided token. */ function addAllowableToken(address token, address underlyingToken, uint8 underlyingTokenDecimals, uint16 points) external; /** * @param token The address of the token that will be removed from farming. */ function removeAllowableToken(address token) external; /** * Changes the reward points for the provided token. Reward points are a weighting system that enables certain * tokens to accrue DMG faster than others, allowing the protocol to prioritize certain deposits. */ function setRewardPointsByToken(address token, uint16 points) external; /** * Sets the DMG growth coefficient to use the new parameter provided. This variable is used to define how much * DMG is earned every second, for each point accrued. */ function setDmgGrowthCoefficient(uint dmgGrowthCoefficient) external; /** * Begins the farming process so users that accumulate DMG by locking tokens can start for this rotation. Calling * this function increments the currentSeasonIndex, starting a new season. This function reverts if there is * already an active season. * * @param dmgAmount The amount of DMG that will be used to fund this campaign. */ function beginFarmingSeason(uint dmgAmount) external; /** * Ends the active farming process if the admin calls this function. Otherwise, anyone may call this function once * all DMG have been drained from the contract. * * @param dustRecipient The recipient of any leftover DMG in this contract, when the campaign finishes. */ function endActiveFarmingSeason(address dustRecipient) external; // //////////////////// // Misc Functions // //////////////////// /** * @return The tokens that the farm supports. */ function getFarmTokens() external view returns (address[] memory); /** * @return True if the provided token is supported for farming, or false if it's not. */ function isSupportedToken(address token) external view returns (bool); /** * @return True if there is an active season for farming, or false if there isn't one. */ function isFarmActive() external view returns (bool); /** * The address that acts as a "secondary" owner with quicker access to function calling than the owner. Typically, * this is the DMMF. */ function guardian() external view returns (address); /** * @return The DMG token. */ function dmgToken() external view returns (address); /** * @return The growth coefficient for earning DMG while farming. Each unit represents how much DMG is earned per * point */ function dmgGrowthCoefficient() external view returns (uint); /** * @return The amount of points that the provided token earns for each unit of token deposited. Defaults to `1` * if the provided `token` does not exist or does not have a special weight. This number is `2` decimals. */ function getRewardPointsByToken(address token) external view returns (uint16); /** * @return The number of decimals that the underlying token has. */ function getTokenDecimalsByToken(address token) external view returns (uint8); /** * @return The index into the array returned from `getFarmTokens`, plus 1. 0 if the token isn't found. If the * index returned is non-zero, subtract 1 from it to get the real index into the array. */ function getTokenIndexPlusOneByToken(address token) external view returns (uint); // //////////////////// // User Functions // //////////////////// /** * Approves the spender from `msg.sender` to transfer funds into the contract on the user's behalf. If `isTrusted` * is marked as false, removes the spender. */ function approve(address spender, bool isTrusted) external; /** * True if the `spender` can transfer tokens on the user's behalf to this contract. */ function isApproved(address user, address spender) external view returns (bool); /** * Begins a farm by transferring `amount` of `token` from `user` to this contract and adds it to the balance of * `user`. `user` must be either 1) msg.sender or 2) a wallet who has approved msg.sender as a proxy; else this * function reverts. `funder` must fit into the same criteria as `user`; else this function reverts */ function beginFarming(address user, address funder, address token, uint amount) external; /** * Ends a farm by transferring all of `token` deposited by `from` to `recipient`, from this contract, as well as * all earned DMG for farming `token` to `recipient`. `from` must be either 1) msg.sender or 2) an approved * proxy; else this function reverts. * * @return The amount of `token` withdrawn and the amount of DMG earned for farming. Both values are sent to * `recipient`. */ function endFarmingByToken(address from, address recipient, address token) external returns (uint, uint); /** * Withdraws all of `msg.sender`'s tokens from the farm to `recipient`. This function reverts if there is an active * farm. `user` must be either 1) msg.sender or 2) an approved proxy; else this function reverts. */ function withdrawAllWhenOutOfSeason(address user, address recipient) external; /** * Withdraws all of `user` `token` from the farm to `recipient`. This function reverts if there is an active farm and the token is NOT removed. * `user` must be either 1) msg.sender or 2) an approved proxy; else this function reverts. * * @return The amount of tokens sent to `recipient` */ function withdrawByTokenWhenOutOfSeason( address user, address recipient, address token ) external returns (uint); /** * @return The amount of DMG that this owner has earned in the active farm. If there are no active season, this * function returns `0`. */ function getRewardBalanceByOwner(address owner) external view returns (uint); /** * @return The amount of DMG that this owner has earned in the active farm for the provided token. If there is no * active season, this function returns `0`. */ function getRewardBalanceByOwnerAndToken(address owner, address token) external view returns (uint); /** * @return The amount of `token` that this owner has deposited into this contract. The user may withdraw this * non-zero balance by invoking `endFarming` or `endFarmingByToken` if there is an active farm. If there is * NO active farm, the user may withdraw his/her funds by invoking */ function balanceOf(address owner, address token) external view returns (uint); /** * @return The most recent timestamp at which the `owner` deposited `token` into the yield farming contract for * the current season. If there is no active season, this function returns `0`. */ function getMostRecentDepositTimestampByOwnerAndToken(address owner, address token) external view returns (uint64); /** * @return The most recent indexed amount of DMG earned by the `owner` for the deposited `token` which is being * farmed for the most-recent season. If there is no active season, this function returns `0`. */ function getMostRecentIndexedDmgEarnedByOwnerAndToken(address owner, address token) external view returns (uint); }
/** * The interface for DMG "Yield Farming" - A process through which users may earn DMG by locking up their mTokens in * Uniswap pools, and staking the Uniswap pool's equity token in this contract. * * Yield farming in the DMM Ecosystem entails "rotation periods" in which a season is active, in order to incentivize * deposits of underlying tokens into the protocol. */
NatSpecMultiLine
endActiveFarmingSeason
function endActiveFarmingSeason(address dustRecipient) external;
/** * Ends the active farming process if the admin calls this function. Otherwise, anyone may call this function once * all DMG have been drained from the contract. * * @param dustRecipient The recipient of any leftover DMG in this contract, when the campaign finishes. */
NatSpecMultiLine
v0.5.13+commit.5b0b510c
Apache-2.0
bzzr://109d8c35d03b8ade3d7a4b4f689a030d34e0cce256c34dbd0f4a6b95b7701a2e
{ "func_code_index": [ 3936, 4005 ] }
2,398
DMGYieldFarmingRouter
contracts/external/farming/v1/IDMGYieldFarmingV1.sol
0x85455fc1428ceee0072309f87a227d53783ba6a8
Solidity
IDMGYieldFarmingV1
interface IDMGYieldFarmingV1 { // //////////////////// // Events // //////////////////// event GlobalProxySet(address indexed proxy, bool isTrusted); event TokenAdded(address indexed token, address indexed underlyingToken, uint8 underlyingTokenDecimals, uint16 points); event TokenRemoved(address indexed token); event FarmSeasonBegun(uint indexed seasonIndex, uint dmgAmount); event FarmSeasonEnd(uint indexed seasonIndex, address dustRecipient, uint dustyDmgAmount); event DmgGrowthCoefficientSet(uint coefficient); event RewardPointsSet(address indexed token, uint16 points); event Approval(address indexed user, address indexed spender, bool isTrusted); event BeginFarming(address indexed owner, address indexed token, uint depositedAmount); event EndFarming(address indexed owner, address indexed token, uint withdrawnAmount, uint earnedDmgAmount); event WithdrawOutOfSeason(address indexed owner, address indexed token, address indexed recipient, uint amount); // //////////////////// // Admin Functions // //////////////////// /** * Sets the `proxy` as a trusted contract, allowing it to interact with the user, on the user's behalf. * * @param proxy The address that can interact on the user's behalf. * @param isTrusted True if the proxy is trusted or false if it's not (should be removed). */ function approveGloballyTrustedProxy(address proxy, bool isTrusted) external; /** * @return true if the provided `proxy` is globally trusted and may interact with the yield farming contract on a * user's behalf or false otherwise. */ function isGloballyTrustedProxy(address proxy) external view returns (bool); /** * @param token The address of the token to be supported for farming. * @param underlyingToken The token to which this token is pegged. IE a Uniswap-V2 LP equity token for * DAI-mDAI has an underlying token of DAI. * @param underlyingTokenDecimals The number of decimals that the `underlyingToken` has. * @param points The amount of reward points for the provided token. */ function addAllowableToken(address token, address underlyingToken, uint8 underlyingTokenDecimals, uint16 points) external; /** * @param token The address of the token that will be removed from farming. */ function removeAllowableToken(address token) external; /** * Changes the reward points for the provided token. Reward points are a weighting system that enables certain * tokens to accrue DMG faster than others, allowing the protocol to prioritize certain deposits. */ function setRewardPointsByToken(address token, uint16 points) external; /** * Sets the DMG growth coefficient to use the new parameter provided. This variable is used to define how much * DMG is earned every second, for each point accrued. */ function setDmgGrowthCoefficient(uint dmgGrowthCoefficient) external; /** * Begins the farming process so users that accumulate DMG by locking tokens can start for this rotation. Calling * this function increments the currentSeasonIndex, starting a new season. This function reverts if there is * already an active season. * * @param dmgAmount The amount of DMG that will be used to fund this campaign. */ function beginFarmingSeason(uint dmgAmount) external; /** * Ends the active farming process if the admin calls this function. Otherwise, anyone may call this function once * all DMG have been drained from the contract. * * @param dustRecipient The recipient of any leftover DMG in this contract, when the campaign finishes. */ function endActiveFarmingSeason(address dustRecipient) external; // //////////////////// // Misc Functions // //////////////////// /** * @return The tokens that the farm supports. */ function getFarmTokens() external view returns (address[] memory); /** * @return True if the provided token is supported for farming, or false if it's not. */ function isSupportedToken(address token) external view returns (bool); /** * @return True if there is an active season for farming, or false if there isn't one. */ function isFarmActive() external view returns (bool); /** * The address that acts as a "secondary" owner with quicker access to function calling than the owner. Typically, * this is the DMMF. */ function guardian() external view returns (address); /** * @return The DMG token. */ function dmgToken() external view returns (address); /** * @return The growth coefficient for earning DMG while farming. Each unit represents how much DMG is earned per * point */ function dmgGrowthCoefficient() external view returns (uint); /** * @return The amount of points that the provided token earns for each unit of token deposited. Defaults to `1` * if the provided `token` does not exist or does not have a special weight. This number is `2` decimals. */ function getRewardPointsByToken(address token) external view returns (uint16); /** * @return The number of decimals that the underlying token has. */ function getTokenDecimalsByToken(address token) external view returns (uint8); /** * @return The index into the array returned from `getFarmTokens`, plus 1. 0 if the token isn't found. If the * index returned is non-zero, subtract 1 from it to get the real index into the array. */ function getTokenIndexPlusOneByToken(address token) external view returns (uint); // //////////////////// // User Functions // //////////////////// /** * Approves the spender from `msg.sender` to transfer funds into the contract on the user's behalf. If `isTrusted` * is marked as false, removes the spender. */ function approve(address spender, bool isTrusted) external; /** * True if the `spender` can transfer tokens on the user's behalf to this contract. */ function isApproved(address user, address spender) external view returns (bool); /** * Begins a farm by transferring `amount` of `token` from `user` to this contract and adds it to the balance of * `user`. `user` must be either 1) msg.sender or 2) a wallet who has approved msg.sender as a proxy; else this * function reverts. `funder` must fit into the same criteria as `user`; else this function reverts */ function beginFarming(address user, address funder, address token, uint amount) external; /** * Ends a farm by transferring all of `token` deposited by `from` to `recipient`, from this contract, as well as * all earned DMG for farming `token` to `recipient`. `from` must be either 1) msg.sender or 2) an approved * proxy; else this function reverts. * * @return The amount of `token` withdrawn and the amount of DMG earned for farming. Both values are sent to * `recipient`. */ function endFarmingByToken(address from, address recipient, address token) external returns (uint, uint); /** * Withdraws all of `msg.sender`'s tokens from the farm to `recipient`. This function reverts if there is an active * farm. `user` must be either 1) msg.sender or 2) an approved proxy; else this function reverts. */ function withdrawAllWhenOutOfSeason(address user, address recipient) external; /** * Withdraws all of `user` `token` from the farm to `recipient`. This function reverts if there is an active farm and the token is NOT removed. * `user` must be either 1) msg.sender or 2) an approved proxy; else this function reverts. * * @return The amount of tokens sent to `recipient` */ function withdrawByTokenWhenOutOfSeason( address user, address recipient, address token ) external returns (uint); /** * @return The amount of DMG that this owner has earned in the active farm. If there are no active season, this * function returns `0`. */ function getRewardBalanceByOwner(address owner) external view returns (uint); /** * @return The amount of DMG that this owner has earned in the active farm for the provided token. If there is no * active season, this function returns `0`. */ function getRewardBalanceByOwnerAndToken(address owner, address token) external view returns (uint); /** * @return The amount of `token` that this owner has deposited into this contract. The user may withdraw this * non-zero balance by invoking `endFarming` or `endFarmingByToken` if there is an active farm. If there is * NO active farm, the user may withdraw his/her funds by invoking */ function balanceOf(address owner, address token) external view returns (uint); /** * @return The most recent timestamp at which the `owner` deposited `token` into the yield farming contract for * the current season. If there is no active season, this function returns `0`. */ function getMostRecentDepositTimestampByOwnerAndToken(address owner, address token) external view returns (uint64); /** * @return The most recent indexed amount of DMG earned by the `owner` for the deposited `token` which is being * farmed for the most-recent season. If there is no active season, this function returns `0`. */ function getMostRecentIndexedDmgEarnedByOwnerAndToken(address owner, address token) external view returns (uint); }
/** * The interface for DMG "Yield Farming" - A process through which users may earn DMG by locking up their mTokens in * Uniswap pools, and staking the Uniswap pool's equity token in this contract. * * Yield farming in the DMM Ecosystem entails "rotation periods" in which a season is active, in order to incentivize * deposits of underlying tokens into the protocol. */
NatSpecMultiLine
getFarmTokens
function getFarmTokens() external view returns (address[] memory);
/** * @return The tokens that the farm supports. */
NatSpecMultiLine
v0.5.13+commit.5b0b510c
Apache-2.0
bzzr://109d8c35d03b8ade3d7a4b4f689a030d34e0cce256c34dbd0f4a6b95b7701a2e
{ "func_code_index": [ 4161, 4232 ] }
2,399
DMGYieldFarmingRouter
contracts/external/farming/v1/IDMGYieldFarmingV1.sol
0x85455fc1428ceee0072309f87a227d53783ba6a8
Solidity
IDMGYieldFarmingV1
interface IDMGYieldFarmingV1 { // //////////////////// // Events // //////////////////// event GlobalProxySet(address indexed proxy, bool isTrusted); event TokenAdded(address indexed token, address indexed underlyingToken, uint8 underlyingTokenDecimals, uint16 points); event TokenRemoved(address indexed token); event FarmSeasonBegun(uint indexed seasonIndex, uint dmgAmount); event FarmSeasonEnd(uint indexed seasonIndex, address dustRecipient, uint dustyDmgAmount); event DmgGrowthCoefficientSet(uint coefficient); event RewardPointsSet(address indexed token, uint16 points); event Approval(address indexed user, address indexed spender, bool isTrusted); event BeginFarming(address indexed owner, address indexed token, uint depositedAmount); event EndFarming(address indexed owner, address indexed token, uint withdrawnAmount, uint earnedDmgAmount); event WithdrawOutOfSeason(address indexed owner, address indexed token, address indexed recipient, uint amount); // //////////////////// // Admin Functions // //////////////////// /** * Sets the `proxy` as a trusted contract, allowing it to interact with the user, on the user's behalf. * * @param proxy The address that can interact on the user's behalf. * @param isTrusted True if the proxy is trusted or false if it's not (should be removed). */ function approveGloballyTrustedProxy(address proxy, bool isTrusted) external; /** * @return true if the provided `proxy` is globally trusted and may interact with the yield farming contract on a * user's behalf or false otherwise. */ function isGloballyTrustedProxy(address proxy) external view returns (bool); /** * @param token The address of the token to be supported for farming. * @param underlyingToken The token to which this token is pegged. IE a Uniswap-V2 LP equity token for * DAI-mDAI has an underlying token of DAI. * @param underlyingTokenDecimals The number of decimals that the `underlyingToken` has. * @param points The amount of reward points for the provided token. */ function addAllowableToken(address token, address underlyingToken, uint8 underlyingTokenDecimals, uint16 points) external; /** * @param token The address of the token that will be removed from farming. */ function removeAllowableToken(address token) external; /** * Changes the reward points for the provided token. Reward points are a weighting system that enables certain * tokens to accrue DMG faster than others, allowing the protocol to prioritize certain deposits. */ function setRewardPointsByToken(address token, uint16 points) external; /** * Sets the DMG growth coefficient to use the new parameter provided. This variable is used to define how much * DMG is earned every second, for each point accrued. */ function setDmgGrowthCoefficient(uint dmgGrowthCoefficient) external; /** * Begins the farming process so users that accumulate DMG by locking tokens can start for this rotation. Calling * this function increments the currentSeasonIndex, starting a new season. This function reverts if there is * already an active season. * * @param dmgAmount The amount of DMG that will be used to fund this campaign. */ function beginFarmingSeason(uint dmgAmount) external; /** * Ends the active farming process if the admin calls this function. Otherwise, anyone may call this function once * all DMG have been drained from the contract. * * @param dustRecipient The recipient of any leftover DMG in this contract, when the campaign finishes. */ function endActiveFarmingSeason(address dustRecipient) external; // //////////////////// // Misc Functions // //////////////////// /** * @return The tokens that the farm supports. */ function getFarmTokens() external view returns (address[] memory); /** * @return True if the provided token is supported for farming, or false if it's not. */ function isSupportedToken(address token) external view returns (bool); /** * @return True if there is an active season for farming, or false if there isn't one. */ function isFarmActive() external view returns (bool); /** * The address that acts as a "secondary" owner with quicker access to function calling than the owner. Typically, * this is the DMMF. */ function guardian() external view returns (address); /** * @return The DMG token. */ function dmgToken() external view returns (address); /** * @return The growth coefficient for earning DMG while farming. Each unit represents how much DMG is earned per * point */ function dmgGrowthCoefficient() external view returns (uint); /** * @return The amount of points that the provided token earns for each unit of token deposited. Defaults to `1` * if the provided `token` does not exist or does not have a special weight. This number is `2` decimals. */ function getRewardPointsByToken(address token) external view returns (uint16); /** * @return The number of decimals that the underlying token has. */ function getTokenDecimalsByToken(address token) external view returns (uint8); /** * @return The index into the array returned from `getFarmTokens`, plus 1. 0 if the token isn't found. If the * index returned is non-zero, subtract 1 from it to get the real index into the array. */ function getTokenIndexPlusOneByToken(address token) external view returns (uint); // //////////////////// // User Functions // //////////////////// /** * Approves the spender from `msg.sender` to transfer funds into the contract on the user's behalf. If `isTrusted` * is marked as false, removes the spender. */ function approve(address spender, bool isTrusted) external; /** * True if the `spender` can transfer tokens on the user's behalf to this contract. */ function isApproved(address user, address spender) external view returns (bool); /** * Begins a farm by transferring `amount` of `token` from `user` to this contract and adds it to the balance of * `user`. `user` must be either 1) msg.sender or 2) a wallet who has approved msg.sender as a proxy; else this * function reverts. `funder` must fit into the same criteria as `user`; else this function reverts */ function beginFarming(address user, address funder, address token, uint amount) external; /** * Ends a farm by transferring all of `token` deposited by `from` to `recipient`, from this contract, as well as * all earned DMG for farming `token` to `recipient`. `from` must be either 1) msg.sender or 2) an approved * proxy; else this function reverts. * * @return The amount of `token` withdrawn and the amount of DMG earned for farming. Both values are sent to * `recipient`. */ function endFarmingByToken(address from, address recipient, address token) external returns (uint, uint); /** * Withdraws all of `msg.sender`'s tokens from the farm to `recipient`. This function reverts if there is an active * farm. `user` must be either 1) msg.sender or 2) an approved proxy; else this function reverts. */ function withdrawAllWhenOutOfSeason(address user, address recipient) external; /** * Withdraws all of `user` `token` from the farm to `recipient`. This function reverts if there is an active farm and the token is NOT removed. * `user` must be either 1) msg.sender or 2) an approved proxy; else this function reverts. * * @return The amount of tokens sent to `recipient` */ function withdrawByTokenWhenOutOfSeason( address user, address recipient, address token ) external returns (uint); /** * @return The amount of DMG that this owner has earned in the active farm. If there are no active season, this * function returns `0`. */ function getRewardBalanceByOwner(address owner) external view returns (uint); /** * @return The amount of DMG that this owner has earned in the active farm for the provided token. If there is no * active season, this function returns `0`. */ function getRewardBalanceByOwnerAndToken(address owner, address token) external view returns (uint); /** * @return The amount of `token` that this owner has deposited into this contract. The user may withdraw this * non-zero balance by invoking `endFarming` or `endFarmingByToken` if there is an active farm. If there is * NO active farm, the user may withdraw his/her funds by invoking */ function balanceOf(address owner, address token) external view returns (uint); /** * @return The most recent timestamp at which the `owner` deposited `token` into the yield farming contract for * the current season. If there is no active season, this function returns `0`. */ function getMostRecentDepositTimestampByOwnerAndToken(address owner, address token) external view returns (uint64); /** * @return The most recent indexed amount of DMG earned by the `owner` for the deposited `token` which is being * farmed for the most-recent season. If there is no active season, this function returns `0`. */ function getMostRecentIndexedDmgEarnedByOwnerAndToken(address owner, address token) external view returns (uint); }
/** * The interface for DMG "Yield Farming" - A process through which users may earn DMG by locking up their mTokens in * Uniswap pools, and staking the Uniswap pool's equity token in this contract. * * Yield farming in the DMM Ecosystem entails "rotation periods" in which a season is active, in order to incentivize * deposits of underlying tokens into the protocol. */
NatSpecMultiLine
isSupportedToken
function isSupportedToken(address token) external view returns (bool);
/** * @return True if the provided token is supported for farming, or false if it's not. */
NatSpecMultiLine
v0.5.13+commit.5b0b510c
Apache-2.0
bzzr://109d8c35d03b8ade3d7a4b4f689a030d34e0cce256c34dbd0f4a6b95b7701a2e
{ "func_code_index": [ 4345, 4420 ] }
2,400
DMGYieldFarmingRouter
contracts/external/farming/v1/IDMGYieldFarmingV1.sol
0x85455fc1428ceee0072309f87a227d53783ba6a8
Solidity
IDMGYieldFarmingV1
interface IDMGYieldFarmingV1 { // //////////////////// // Events // //////////////////// event GlobalProxySet(address indexed proxy, bool isTrusted); event TokenAdded(address indexed token, address indexed underlyingToken, uint8 underlyingTokenDecimals, uint16 points); event TokenRemoved(address indexed token); event FarmSeasonBegun(uint indexed seasonIndex, uint dmgAmount); event FarmSeasonEnd(uint indexed seasonIndex, address dustRecipient, uint dustyDmgAmount); event DmgGrowthCoefficientSet(uint coefficient); event RewardPointsSet(address indexed token, uint16 points); event Approval(address indexed user, address indexed spender, bool isTrusted); event BeginFarming(address indexed owner, address indexed token, uint depositedAmount); event EndFarming(address indexed owner, address indexed token, uint withdrawnAmount, uint earnedDmgAmount); event WithdrawOutOfSeason(address indexed owner, address indexed token, address indexed recipient, uint amount); // //////////////////// // Admin Functions // //////////////////// /** * Sets the `proxy` as a trusted contract, allowing it to interact with the user, on the user's behalf. * * @param proxy The address that can interact on the user's behalf. * @param isTrusted True if the proxy is trusted or false if it's not (should be removed). */ function approveGloballyTrustedProxy(address proxy, bool isTrusted) external; /** * @return true if the provided `proxy` is globally trusted and may interact with the yield farming contract on a * user's behalf or false otherwise. */ function isGloballyTrustedProxy(address proxy) external view returns (bool); /** * @param token The address of the token to be supported for farming. * @param underlyingToken The token to which this token is pegged. IE a Uniswap-V2 LP equity token for * DAI-mDAI has an underlying token of DAI. * @param underlyingTokenDecimals The number of decimals that the `underlyingToken` has. * @param points The amount of reward points for the provided token. */ function addAllowableToken(address token, address underlyingToken, uint8 underlyingTokenDecimals, uint16 points) external; /** * @param token The address of the token that will be removed from farming. */ function removeAllowableToken(address token) external; /** * Changes the reward points for the provided token. Reward points are a weighting system that enables certain * tokens to accrue DMG faster than others, allowing the protocol to prioritize certain deposits. */ function setRewardPointsByToken(address token, uint16 points) external; /** * Sets the DMG growth coefficient to use the new parameter provided. This variable is used to define how much * DMG is earned every second, for each point accrued. */ function setDmgGrowthCoefficient(uint dmgGrowthCoefficient) external; /** * Begins the farming process so users that accumulate DMG by locking tokens can start for this rotation. Calling * this function increments the currentSeasonIndex, starting a new season. This function reverts if there is * already an active season. * * @param dmgAmount The amount of DMG that will be used to fund this campaign. */ function beginFarmingSeason(uint dmgAmount) external; /** * Ends the active farming process if the admin calls this function. Otherwise, anyone may call this function once * all DMG have been drained from the contract. * * @param dustRecipient The recipient of any leftover DMG in this contract, when the campaign finishes. */ function endActiveFarmingSeason(address dustRecipient) external; // //////////////////// // Misc Functions // //////////////////// /** * @return The tokens that the farm supports. */ function getFarmTokens() external view returns (address[] memory); /** * @return True if the provided token is supported for farming, or false if it's not. */ function isSupportedToken(address token) external view returns (bool); /** * @return True if there is an active season for farming, or false if there isn't one. */ function isFarmActive() external view returns (bool); /** * The address that acts as a "secondary" owner with quicker access to function calling than the owner. Typically, * this is the DMMF. */ function guardian() external view returns (address); /** * @return The DMG token. */ function dmgToken() external view returns (address); /** * @return The growth coefficient for earning DMG while farming. Each unit represents how much DMG is earned per * point */ function dmgGrowthCoefficient() external view returns (uint); /** * @return The amount of points that the provided token earns for each unit of token deposited. Defaults to `1` * if the provided `token` does not exist or does not have a special weight. This number is `2` decimals. */ function getRewardPointsByToken(address token) external view returns (uint16); /** * @return The number of decimals that the underlying token has. */ function getTokenDecimalsByToken(address token) external view returns (uint8); /** * @return The index into the array returned from `getFarmTokens`, plus 1. 0 if the token isn't found. If the * index returned is non-zero, subtract 1 from it to get the real index into the array. */ function getTokenIndexPlusOneByToken(address token) external view returns (uint); // //////////////////// // User Functions // //////////////////// /** * Approves the spender from `msg.sender` to transfer funds into the contract on the user's behalf. If `isTrusted` * is marked as false, removes the spender. */ function approve(address spender, bool isTrusted) external; /** * True if the `spender` can transfer tokens on the user's behalf to this contract. */ function isApproved(address user, address spender) external view returns (bool); /** * Begins a farm by transferring `amount` of `token` from `user` to this contract and adds it to the balance of * `user`. `user` must be either 1) msg.sender or 2) a wallet who has approved msg.sender as a proxy; else this * function reverts. `funder` must fit into the same criteria as `user`; else this function reverts */ function beginFarming(address user, address funder, address token, uint amount) external; /** * Ends a farm by transferring all of `token` deposited by `from` to `recipient`, from this contract, as well as * all earned DMG for farming `token` to `recipient`. `from` must be either 1) msg.sender or 2) an approved * proxy; else this function reverts. * * @return The amount of `token` withdrawn and the amount of DMG earned for farming. Both values are sent to * `recipient`. */ function endFarmingByToken(address from, address recipient, address token) external returns (uint, uint); /** * Withdraws all of `msg.sender`'s tokens from the farm to `recipient`. This function reverts if there is an active * farm. `user` must be either 1) msg.sender or 2) an approved proxy; else this function reverts. */ function withdrawAllWhenOutOfSeason(address user, address recipient) external; /** * Withdraws all of `user` `token` from the farm to `recipient`. This function reverts if there is an active farm and the token is NOT removed. * `user` must be either 1) msg.sender or 2) an approved proxy; else this function reverts. * * @return The amount of tokens sent to `recipient` */ function withdrawByTokenWhenOutOfSeason( address user, address recipient, address token ) external returns (uint); /** * @return The amount of DMG that this owner has earned in the active farm. If there are no active season, this * function returns `0`. */ function getRewardBalanceByOwner(address owner) external view returns (uint); /** * @return The amount of DMG that this owner has earned in the active farm for the provided token. If there is no * active season, this function returns `0`. */ function getRewardBalanceByOwnerAndToken(address owner, address token) external view returns (uint); /** * @return The amount of `token` that this owner has deposited into this contract. The user may withdraw this * non-zero balance by invoking `endFarming` or `endFarmingByToken` if there is an active farm. If there is * NO active farm, the user may withdraw his/her funds by invoking */ function balanceOf(address owner, address token) external view returns (uint); /** * @return The most recent timestamp at which the `owner` deposited `token` into the yield farming contract for * the current season. If there is no active season, this function returns `0`. */ function getMostRecentDepositTimestampByOwnerAndToken(address owner, address token) external view returns (uint64); /** * @return The most recent indexed amount of DMG earned by the `owner` for the deposited `token` which is being * farmed for the most-recent season. If there is no active season, this function returns `0`. */ function getMostRecentIndexedDmgEarnedByOwnerAndToken(address owner, address token) external view returns (uint); }
/** * The interface for DMG "Yield Farming" - A process through which users may earn DMG by locking up their mTokens in * Uniswap pools, and staking the Uniswap pool's equity token in this contract. * * Yield farming in the DMM Ecosystem entails "rotation periods" in which a season is active, in order to incentivize * deposits of underlying tokens into the protocol. */
NatSpecMultiLine
isFarmActive
function isFarmActive() external view returns (bool);
/** * @return True if there is an active season for farming, or false if there isn't one. */
NatSpecMultiLine
v0.5.13+commit.5b0b510c
Apache-2.0
bzzr://109d8c35d03b8ade3d7a4b4f689a030d34e0cce256c34dbd0f4a6b95b7701a2e
{ "func_code_index": [ 4534, 4592 ] }
2,401
DMGYieldFarmingRouter
contracts/external/farming/v1/IDMGYieldFarmingV1.sol
0x85455fc1428ceee0072309f87a227d53783ba6a8
Solidity
IDMGYieldFarmingV1
interface IDMGYieldFarmingV1 { // //////////////////// // Events // //////////////////// event GlobalProxySet(address indexed proxy, bool isTrusted); event TokenAdded(address indexed token, address indexed underlyingToken, uint8 underlyingTokenDecimals, uint16 points); event TokenRemoved(address indexed token); event FarmSeasonBegun(uint indexed seasonIndex, uint dmgAmount); event FarmSeasonEnd(uint indexed seasonIndex, address dustRecipient, uint dustyDmgAmount); event DmgGrowthCoefficientSet(uint coefficient); event RewardPointsSet(address indexed token, uint16 points); event Approval(address indexed user, address indexed spender, bool isTrusted); event BeginFarming(address indexed owner, address indexed token, uint depositedAmount); event EndFarming(address indexed owner, address indexed token, uint withdrawnAmount, uint earnedDmgAmount); event WithdrawOutOfSeason(address indexed owner, address indexed token, address indexed recipient, uint amount); // //////////////////// // Admin Functions // //////////////////// /** * Sets the `proxy` as a trusted contract, allowing it to interact with the user, on the user's behalf. * * @param proxy The address that can interact on the user's behalf. * @param isTrusted True if the proxy is trusted or false if it's not (should be removed). */ function approveGloballyTrustedProxy(address proxy, bool isTrusted) external; /** * @return true if the provided `proxy` is globally trusted and may interact with the yield farming contract on a * user's behalf or false otherwise. */ function isGloballyTrustedProxy(address proxy) external view returns (bool); /** * @param token The address of the token to be supported for farming. * @param underlyingToken The token to which this token is pegged. IE a Uniswap-V2 LP equity token for * DAI-mDAI has an underlying token of DAI. * @param underlyingTokenDecimals The number of decimals that the `underlyingToken` has. * @param points The amount of reward points for the provided token. */ function addAllowableToken(address token, address underlyingToken, uint8 underlyingTokenDecimals, uint16 points) external; /** * @param token The address of the token that will be removed from farming. */ function removeAllowableToken(address token) external; /** * Changes the reward points for the provided token. Reward points are a weighting system that enables certain * tokens to accrue DMG faster than others, allowing the protocol to prioritize certain deposits. */ function setRewardPointsByToken(address token, uint16 points) external; /** * Sets the DMG growth coefficient to use the new parameter provided. This variable is used to define how much * DMG is earned every second, for each point accrued. */ function setDmgGrowthCoefficient(uint dmgGrowthCoefficient) external; /** * Begins the farming process so users that accumulate DMG by locking tokens can start for this rotation. Calling * this function increments the currentSeasonIndex, starting a new season. This function reverts if there is * already an active season. * * @param dmgAmount The amount of DMG that will be used to fund this campaign. */ function beginFarmingSeason(uint dmgAmount) external; /** * Ends the active farming process if the admin calls this function. Otherwise, anyone may call this function once * all DMG have been drained from the contract. * * @param dustRecipient The recipient of any leftover DMG in this contract, when the campaign finishes. */ function endActiveFarmingSeason(address dustRecipient) external; // //////////////////// // Misc Functions // //////////////////// /** * @return The tokens that the farm supports. */ function getFarmTokens() external view returns (address[] memory); /** * @return True if the provided token is supported for farming, or false if it's not. */ function isSupportedToken(address token) external view returns (bool); /** * @return True if there is an active season for farming, or false if there isn't one. */ function isFarmActive() external view returns (bool); /** * The address that acts as a "secondary" owner with quicker access to function calling than the owner. Typically, * this is the DMMF. */ function guardian() external view returns (address); /** * @return The DMG token. */ function dmgToken() external view returns (address); /** * @return The growth coefficient for earning DMG while farming. Each unit represents how much DMG is earned per * point */ function dmgGrowthCoefficient() external view returns (uint); /** * @return The amount of points that the provided token earns for each unit of token deposited. Defaults to `1` * if the provided `token` does not exist or does not have a special weight. This number is `2` decimals. */ function getRewardPointsByToken(address token) external view returns (uint16); /** * @return The number of decimals that the underlying token has. */ function getTokenDecimalsByToken(address token) external view returns (uint8); /** * @return The index into the array returned from `getFarmTokens`, plus 1. 0 if the token isn't found. If the * index returned is non-zero, subtract 1 from it to get the real index into the array. */ function getTokenIndexPlusOneByToken(address token) external view returns (uint); // //////////////////// // User Functions // //////////////////// /** * Approves the spender from `msg.sender` to transfer funds into the contract on the user's behalf. If `isTrusted` * is marked as false, removes the spender. */ function approve(address spender, bool isTrusted) external; /** * True if the `spender` can transfer tokens on the user's behalf to this contract. */ function isApproved(address user, address spender) external view returns (bool); /** * Begins a farm by transferring `amount` of `token` from `user` to this contract and adds it to the balance of * `user`. `user` must be either 1) msg.sender or 2) a wallet who has approved msg.sender as a proxy; else this * function reverts. `funder` must fit into the same criteria as `user`; else this function reverts */ function beginFarming(address user, address funder, address token, uint amount) external; /** * Ends a farm by transferring all of `token` deposited by `from` to `recipient`, from this contract, as well as * all earned DMG for farming `token` to `recipient`. `from` must be either 1) msg.sender or 2) an approved * proxy; else this function reverts. * * @return The amount of `token` withdrawn and the amount of DMG earned for farming. Both values are sent to * `recipient`. */ function endFarmingByToken(address from, address recipient, address token) external returns (uint, uint); /** * Withdraws all of `msg.sender`'s tokens from the farm to `recipient`. This function reverts if there is an active * farm. `user` must be either 1) msg.sender or 2) an approved proxy; else this function reverts. */ function withdrawAllWhenOutOfSeason(address user, address recipient) external; /** * Withdraws all of `user` `token` from the farm to `recipient`. This function reverts if there is an active farm and the token is NOT removed. * `user` must be either 1) msg.sender or 2) an approved proxy; else this function reverts. * * @return The amount of tokens sent to `recipient` */ function withdrawByTokenWhenOutOfSeason( address user, address recipient, address token ) external returns (uint); /** * @return The amount of DMG that this owner has earned in the active farm. If there are no active season, this * function returns `0`. */ function getRewardBalanceByOwner(address owner) external view returns (uint); /** * @return The amount of DMG that this owner has earned in the active farm for the provided token. If there is no * active season, this function returns `0`. */ function getRewardBalanceByOwnerAndToken(address owner, address token) external view returns (uint); /** * @return The amount of `token` that this owner has deposited into this contract. The user may withdraw this * non-zero balance by invoking `endFarming` or `endFarmingByToken` if there is an active farm. If there is * NO active farm, the user may withdraw his/her funds by invoking */ function balanceOf(address owner, address token) external view returns (uint); /** * @return The most recent timestamp at which the `owner` deposited `token` into the yield farming contract for * the current season. If there is no active season, this function returns `0`. */ function getMostRecentDepositTimestampByOwnerAndToken(address owner, address token) external view returns (uint64); /** * @return The most recent indexed amount of DMG earned by the `owner` for the deposited `token` which is being * farmed for the most-recent season. If there is no active season, this function returns `0`. */ function getMostRecentIndexedDmgEarnedByOwnerAndToken(address owner, address token) external view returns (uint); }
/** * The interface for DMG "Yield Farming" - A process through which users may earn DMG by locking up their mTokens in * Uniswap pools, and staking the Uniswap pool's equity token in this contract. * * Yield farming in the DMM Ecosystem entails "rotation periods" in which a season is active, in order to incentivize * deposits of underlying tokens into the protocol. */
NatSpecMultiLine
guardian
function guardian() external view returns (address);
/** * The address that acts as a "secondary" owner with quicker access to function calling than the owner. Typically, * this is the DMMF. */
NatSpecMultiLine
v0.5.13+commit.5b0b510c
Apache-2.0
bzzr://109d8c35d03b8ade3d7a4b4f689a030d34e0cce256c34dbd0f4a6b95b7701a2e
{ "func_code_index": [ 4759, 4816 ] }
2,402
DMGYieldFarmingRouter
contracts/external/farming/v1/IDMGYieldFarmingV1.sol
0x85455fc1428ceee0072309f87a227d53783ba6a8
Solidity
IDMGYieldFarmingV1
interface IDMGYieldFarmingV1 { // //////////////////// // Events // //////////////////// event GlobalProxySet(address indexed proxy, bool isTrusted); event TokenAdded(address indexed token, address indexed underlyingToken, uint8 underlyingTokenDecimals, uint16 points); event TokenRemoved(address indexed token); event FarmSeasonBegun(uint indexed seasonIndex, uint dmgAmount); event FarmSeasonEnd(uint indexed seasonIndex, address dustRecipient, uint dustyDmgAmount); event DmgGrowthCoefficientSet(uint coefficient); event RewardPointsSet(address indexed token, uint16 points); event Approval(address indexed user, address indexed spender, bool isTrusted); event BeginFarming(address indexed owner, address indexed token, uint depositedAmount); event EndFarming(address indexed owner, address indexed token, uint withdrawnAmount, uint earnedDmgAmount); event WithdrawOutOfSeason(address indexed owner, address indexed token, address indexed recipient, uint amount); // //////////////////// // Admin Functions // //////////////////// /** * Sets the `proxy` as a trusted contract, allowing it to interact with the user, on the user's behalf. * * @param proxy The address that can interact on the user's behalf. * @param isTrusted True if the proxy is trusted or false if it's not (should be removed). */ function approveGloballyTrustedProxy(address proxy, bool isTrusted) external; /** * @return true if the provided `proxy` is globally trusted and may interact with the yield farming contract on a * user's behalf or false otherwise. */ function isGloballyTrustedProxy(address proxy) external view returns (bool); /** * @param token The address of the token to be supported for farming. * @param underlyingToken The token to which this token is pegged. IE a Uniswap-V2 LP equity token for * DAI-mDAI has an underlying token of DAI. * @param underlyingTokenDecimals The number of decimals that the `underlyingToken` has. * @param points The amount of reward points for the provided token. */ function addAllowableToken(address token, address underlyingToken, uint8 underlyingTokenDecimals, uint16 points) external; /** * @param token The address of the token that will be removed from farming. */ function removeAllowableToken(address token) external; /** * Changes the reward points for the provided token. Reward points are a weighting system that enables certain * tokens to accrue DMG faster than others, allowing the protocol to prioritize certain deposits. */ function setRewardPointsByToken(address token, uint16 points) external; /** * Sets the DMG growth coefficient to use the new parameter provided. This variable is used to define how much * DMG is earned every second, for each point accrued. */ function setDmgGrowthCoefficient(uint dmgGrowthCoefficient) external; /** * Begins the farming process so users that accumulate DMG by locking tokens can start for this rotation. Calling * this function increments the currentSeasonIndex, starting a new season. This function reverts if there is * already an active season. * * @param dmgAmount The amount of DMG that will be used to fund this campaign. */ function beginFarmingSeason(uint dmgAmount) external; /** * Ends the active farming process if the admin calls this function. Otherwise, anyone may call this function once * all DMG have been drained from the contract. * * @param dustRecipient The recipient of any leftover DMG in this contract, when the campaign finishes. */ function endActiveFarmingSeason(address dustRecipient) external; // //////////////////// // Misc Functions // //////////////////// /** * @return The tokens that the farm supports. */ function getFarmTokens() external view returns (address[] memory); /** * @return True if the provided token is supported for farming, or false if it's not. */ function isSupportedToken(address token) external view returns (bool); /** * @return True if there is an active season for farming, or false if there isn't one. */ function isFarmActive() external view returns (bool); /** * The address that acts as a "secondary" owner with quicker access to function calling than the owner. Typically, * this is the DMMF. */ function guardian() external view returns (address); /** * @return The DMG token. */ function dmgToken() external view returns (address); /** * @return The growth coefficient for earning DMG while farming. Each unit represents how much DMG is earned per * point */ function dmgGrowthCoefficient() external view returns (uint); /** * @return The amount of points that the provided token earns for each unit of token deposited. Defaults to `1` * if the provided `token` does not exist or does not have a special weight. This number is `2` decimals. */ function getRewardPointsByToken(address token) external view returns (uint16); /** * @return The number of decimals that the underlying token has. */ function getTokenDecimalsByToken(address token) external view returns (uint8); /** * @return The index into the array returned from `getFarmTokens`, plus 1. 0 if the token isn't found. If the * index returned is non-zero, subtract 1 from it to get the real index into the array. */ function getTokenIndexPlusOneByToken(address token) external view returns (uint); // //////////////////// // User Functions // //////////////////// /** * Approves the spender from `msg.sender` to transfer funds into the contract on the user's behalf. If `isTrusted` * is marked as false, removes the spender. */ function approve(address spender, bool isTrusted) external; /** * True if the `spender` can transfer tokens on the user's behalf to this contract. */ function isApproved(address user, address spender) external view returns (bool); /** * Begins a farm by transferring `amount` of `token` from `user` to this contract and adds it to the balance of * `user`. `user` must be either 1) msg.sender or 2) a wallet who has approved msg.sender as a proxy; else this * function reverts. `funder` must fit into the same criteria as `user`; else this function reverts */ function beginFarming(address user, address funder, address token, uint amount) external; /** * Ends a farm by transferring all of `token` deposited by `from` to `recipient`, from this contract, as well as * all earned DMG for farming `token` to `recipient`. `from` must be either 1) msg.sender or 2) an approved * proxy; else this function reverts. * * @return The amount of `token` withdrawn and the amount of DMG earned for farming. Both values are sent to * `recipient`. */ function endFarmingByToken(address from, address recipient, address token) external returns (uint, uint); /** * Withdraws all of `msg.sender`'s tokens from the farm to `recipient`. This function reverts if there is an active * farm. `user` must be either 1) msg.sender or 2) an approved proxy; else this function reverts. */ function withdrawAllWhenOutOfSeason(address user, address recipient) external; /** * Withdraws all of `user` `token` from the farm to `recipient`. This function reverts if there is an active farm and the token is NOT removed. * `user` must be either 1) msg.sender or 2) an approved proxy; else this function reverts. * * @return The amount of tokens sent to `recipient` */ function withdrawByTokenWhenOutOfSeason( address user, address recipient, address token ) external returns (uint); /** * @return The amount of DMG that this owner has earned in the active farm. If there are no active season, this * function returns `0`. */ function getRewardBalanceByOwner(address owner) external view returns (uint); /** * @return The amount of DMG that this owner has earned in the active farm for the provided token. If there is no * active season, this function returns `0`. */ function getRewardBalanceByOwnerAndToken(address owner, address token) external view returns (uint); /** * @return The amount of `token` that this owner has deposited into this contract. The user may withdraw this * non-zero balance by invoking `endFarming` or `endFarmingByToken` if there is an active farm. If there is * NO active farm, the user may withdraw his/her funds by invoking */ function balanceOf(address owner, address token) external view returns (uint); /** * @return The most recent timestamp at which the `owner` deposited `token` into the yield farming contract for * the current season. If there is no active season, this function returns `0`. */ function getMostRecentDepositTimestampByOwnerAndToken(address owner, address token) external view returns (uint64); /** * @return The most recent indexed amount of DMG earned by the `owner` for the deposited `token` which is being * farmed for the most-recent season. If there is no active season, this function returns `0`. */ function getMostRecentIndexedDmgEarnedByOwnerAndToken(address owner, address token) external view returns (uint); }
/** * The interface for DMG "Yield Farming" - A process through which users may earn DMG by locking up their mTokens in * Uniswap pools, and staking the Uniswap pool's equity token in this contract. * * Yield farming in the DMM Ecosystem entails "rotation periods" in which a season is active, in order to incentivize * deposits of underlying tokens into the protocol. */
NatSpecMultiLine
dmgToken
function dmgToken() external view returns (address);
/** * @return The DMG token. */
NatSpecMultiLine
v0.5.13+commit.5b0b510c
Apache-2.0
bzzr://109d8c35d03b8ade3d7a4b4f689a030d34e0cce256c34dbd0f4a6b95b7701a2e
{ "func_code_index": [ 4868, 4925 ] }
2,403
DMGYieldFarmingRouter
contracts/external/farming/v1/IDMGYieldFarmingV1.sol
0x85455fc1428ceee0072309f87a227d53783ba6a8
Solidity
IDMGYieldFarmingV1
interface IDMGYieldFarmingV1 { // //////////////////// // Events // //////////////////// event GlobalProxySet(address indexed proxy, bool isTrusted); event TokenAdded(address indexed token, address indexed underlyingToken, uint8 underlyingTokenDecimals, uint16 points); event TokenRemoved(address indexed token); event FarmSeasonBegun(uint indexed seasonIndex, uint dmgAmount); event FarmSeasonEnd(uint indexed seasonIndex, address dustRecipient, uint dustyDmgAmount); event DmgGrowthCoefficientSet(uint coefficient); event RewardPointsSet(address indexed token, uint16 points); event Approval(address indexed user, address indexed spender, bool isTrusted); event BeginFarming(address indexed owner, address indexed token, uint depositedAmount); event EndFarming(address indexed owner, address indexed token, uint withdrawnAmount, uint earnedDmgAmount); event WithdrawOutOfSeason(address indexed owner, address indexed token, address indexed recipient, uint amount); // //////////////////// // Admin Functions // //////////////////// /** * Sets the `proxy` as a trusted contract, allowing it to interact with the user, on the user's behalf. * * @param proxy The address that can interact on the user's behalf. * @param isTrusted True if the proxy is trusted or false if it's not (should be removed). */ function approveGloballyTrustedProxy(address proxy, bool isTrusted) external; /** * @return true if the provided `proxy` is globally trusted and may interact with the yield farming contract on a * user's behalf or false otherwise. */ function isGloballyTrustedProxy(address proxy) external view returns (bool); /** * @param token The address of the token to be supported for farming. * @param underlyingToken The token to which this token is pegged. IE a Uniswap-V2 LP equity token for * DAI-mDAI has an underlying token of DAI. * @param underlyingTokenDecimals The number of decimals that the `underlyingToken` has. * @param points The amount of reward points for the provided token. */ function addAllowableToken(address token, address underlyingToken, uint8 underlyingTokenDecimals, uint16 points) external; /** * @param token The address of the token that will be removed from farming. */ function removeAllowableToken(address token) external; /** * Changes the reward points for the provided token. Reward points are a weighting system that enables certain * tokens to accrue DMG faster than others, allowing the protocol to prioritize certain deposits. */ function setRewardPointsByToken(address token, uint16 points) external; /** * Sets the DMG growth coefficient to use the new parameter provided. This variable is used to define how much * DMG is earned every second, for each point accrued. */ function setDmgGrowthCoefficient(uint dmgGrowthCoefficient) external; /** * Begins the farming process so users that accumulate DMG by locking tokens can start for this rotation. Calling * this function increments the currentSeasonIndex, starting a new season. This function reverts if there is * already an active season. * * @param dmgAmount The amount of DMG that will be used to fund this campaign. */ function beginFarmingSeason(uint dmgAmount) external; /** * Ends the active farming process if the admin calls this function. Otherwise, anyone may call this function once * all DMG have been drained from the contract. * * @param dustRecipient The recipient of any leftover DMG in this contract, when the campaign finishes. */ function endActiveFarmingSeason(address dustRecipient) external; // //////////////////// // Misc Functions // //////////////////// /** * @return The tokens that the farm supports. */ function getFarmTokens() external view returns (address[] memory); /** * @return True if the provided token is supported for farming, or false if it's not. */ function isSupportedToken(address token) external view returns (bool); /** * @return True if there is an active season for farming, or false if there isn't one. */ function isFarmActive() external view returns (bool); /** * The address that acts as a "secondary" owner with quicker access to function calling than the owner. Typically, * this is the DMMF. */ function guardian() external view returns (address); /** * @return The DMG token. */ function dmgToken() external view returns (address); /** * @return The growth coefficient for earning DMG while farming. Each unit represents how much DMG is earned per * point */ function dmgGrowthCoefficient() external view returns (uint); /** * @return The amount of points that the provided token earns for each unit of token deposited. Defaults to `1` * if the provided `token` does not exist or does not have a special weight. This number is `2` decimals. */ function getRewardPointsByToken(address token) external view returns (uint16); /** * @return The number of decimals that the underlying token has. */ function getTokenDecimalsByToken(address token) external view returns (uint8); /** * @return The index into the array returned from `getFarmTokens`, plus 1. 0 if the token isn't found. If the * index returned is non-zero, subtract 1 from it to get the real index into the array. */ function getTokenIndexPlusOneByToken(address token) external view returns (uint); // //////////////////// // User Functions // //////////////////// /** * Approves the spender from `msg.sender` to transfer funds into the contract on the user's behalf. If `isTrusted` * is marked as false, removes the spender. */ function approve(address spender, bool isTrusted) external; /** * True if the `spender` can transfer tokens on the user's behalf to this contract. */ function isApproved(address user, address spender) external view returns (bool); /** * Begins a farm by transferring `amount` of `token` from `user` to this contract and adds it to the balance of * `user`. `user` must be either 1) msg.sender or 2) a wallet who has approved msg.sender as a proxy; else this * function reverts. `funder` must fit into the same criteria as `user`; else this function reverts */ function beginFarming(address user, address funder, address token, uint amount) external; /** * Ends a farm by transferring all of `token` deposited by `from` to `recipient`, from this contract, as well as * all earned DMG for farming `token` to `recipient`. `from` must be either 1) msg.sender or 2) an approved * proxy; else this function reverts. * * @return The amount of `token` withdrawn and the amount of DMG earned for farming. Both values are sent to * `recipient`. */ function endFarmingByToken(address from, address recipient, address token) external returns (uint, uint); /** * Withdraws all of `msg.sender`'s tokens from the farm to `recipient`. This function reverts if there is an active * farm. `user` must be either 1) msg.sender or 2) an approved proxy; else this function reverts. */ function withdrawAllWhenOutOfSeason(address user, address recipient) external; /** * Withdraws all of `user` `token` from the farm to `recipient`. This function reverts if there is an active farm and the token is NOT removed. * `user` must be either 1) msg.sender or 2) an approved proxy; else this function reverts. * * @return The amount of tokens sent to `recipient` */ function withdrawByTokenWhenOutOfSeason( address user, address recipient, address token ) external returns (uint); /** * @return The amount of DMG that this owner has earned in the active farm. If there are no active season, this * function returns `0`. */ function getRewardBalanceByOwner(address owner) external view returns (uint); /** * @return The amount of DMG that this owner has earned in the active farm for the provided token. If there is no * active season, this function returns `0`. */ function getRewardBalanceByOwnerAndToken(address owner, address token) external view returns (uint); /** * @return The amount of `token` that this owner has deposited into this contract. The user may withdraw this * non-zero balance by invoking `endFarming` or `endFarmingByToken` if there is an active farm. If there is * NO active farm, the user may withdraw his/her funds by invoking */ function balanceOf(address owner, address token) external view returns (uint); /** * @return The most recent timestamp at which the `owner` deposited `token` into the yield farming contract for * the current season. If there is no active season, this function returns `0`. */ function getMostRecentDepositTimestampByOwnerAndToken(address owner, address token) external view returns (uint64); /** * @return The most recent indexed amount of DMG earned by the `owner` for the deposited `token` which is being * farmed for the most-recent season. If there is no active season, this function returns `0`. */ function getMostRecentIndexedDmgEarnedByOwnerAndToken(address owner, address token) external view returns (uint); }
/** * The interface for DMG "Yield Farming" - A process through which users may earn DMG by locking up their mTokens in * Uniswap pools, and staking the Uniswap pool's equity token in this contract. * * Yield farming in the DMM Ecosystem entails "rotation periods" in which a season is active, in order to incentivize * deposits of underlying tokens into the protocol. */
NatSpecMultiLine
dmgGrowthCoefficient
function dmgGrowthCoefficient() external view returns (uint);
/** * @return The growth coefficient for earning DMG while farming. Each unit represents how much DMG is earned per * point */
NatSpecMultiLine
v0.5.13+commit.5b0b510c
Apache-2.0
bzzr://109d8c35d03b8ade3d7a4b4f689a030d34e0cce256c34dbd0f4a6b95b7701a2e
{ "func_code_index": [ 5088, 5154 ] }
2,404
DMGYieldFarmingRouter
contracts/external/farming/v1/IDMGYieldFarmingV1.sol
0x85455fc1428ceee0072309f87a227d53783ba6a8
Solidity
IDMGYieldFarmingV1
interface IDMGYieldFarmingV1 { // //////////////////// // Events // //////////////////// event GlobalProxySet(address indexed proxy, bool isTrusted); event TokenAdded(address indexed token, address indexed underlyingToken, uint8 underlyingTokenDecimals, uint16 points); event TokenRemoved(address indexed token); event FarmSeasonBegun(uint indexed seasonIndex, uint dmgAmount); event FarmSeasonEnd(uint indexed seasonIndex, address dustRecipient, uint dustyDmgAmount); event DmgGrowthCoefficientSet(uint coefficient); event RewardPointsSet(address indexed token, uint16 points); event Approval(address indexed user, address indexed spender, bool isTrusted); event BeginFarming(address indexed owner, address indexed token, uint depositedAmount); event EndFarming(address indexed owner, address indexed token, uint withdrawnAmount, uint earnedDmgAmount); event WithdrawOutOfSeason(address indexed owner, address indexed token, address indexed recipient, uint amount); // //////////////////// // Admin Functions // //////////////////// /** * Sets the `proxy` as a trusted contract, allowing it to interact with the user, on the user's behalf. * * @param proxy The address that can interact on the user's behalf. * @param isTrusted True if the proxy is trusted or false if it's not (should be removed). */ function approveGloballyTrustedProxy(address proxy, bool isTrusted) external; /** * @return true if the provided `proxy` is globally trusted and may interact with the yield farming contract on a * user's behalf or false otherwise. */ function isGloballyTrustedProxy(address proxy) external view returns (bool); /** * @param token The address of the token to be supported for farming. * @param underlyingToken The token to which this token is pegged. IE a Uniswap-V2 LP equity token for * DAI-mDAI has an underlying token of DAI. * @param underlyingTokenDecimals The number of decimals that the `underlyingToken` has. * @param points The amount of reward points for the provided token. */ function addAllowableToken(address token, address underlyingToken, uint8 underlyingTokenDecimals, uint16 points) external; /** * @param token The address of the token that will be removed from farming. */ function removeAllowableToken(address token) external; /** * Changes the reward points for the provided token. Reward points are a weighting system that enables certain * tokens to accrue DMG faster than others, allowing the protocol to prioritize certain deposits. */ function setRewardPointsByToken(address token, uint16 points) external; /** * Sets the DMG growth coefficient to use the new parameter provided. This variable is used to define how much * DMG is earned every second, for each point accrued. */ function setDmgGrowthCoefficient(uint dmgGrowthCoefficient) external; /** * Begins the farming process so users that accumulate DMG by locking tokens can start for this rotation. Calling * this function increments the currentSeasonIndex, starting a new season. This function reverts if there is * already an active season. * * @param dmgAmount The amount of DMG that will be used to fund this campaign. */ function beginFarmingSeason(uint dmgAmount) external; /** * Ends the active farming process if the admin calls this function. Otherwise, anyone may call this function once * all DMG have been drained from the contract. * * @param dustRecipient The recipient of any leftover DMG in this contract, when the campaign finishes. */ function endActiveFarmingSeason(address dustRecipient) external; // //////////////////// // Misc Functions // //////////////////// /** * @return The tokens that the farm supports. */ function getFarmTokens() external view returns (address[] memory); /** * @return True if the provided token is supported for farming, or false if it's not. */ function isSupportedToken(address token) external view returns (bool); /** * @return True if there is an active season for farming, or false if there isn't one. */ function isFarmActive() external view returns (bool); /** * The address that acts as a "secondary" owner with quicker access to function calling than the owner. Typically, * this is the DMMF. */ function guardian() external view returns (address); /** * @return The DMG token. */ function dmgToken() external view returns (address); /** * @return The growth coefficient for earning DMG while farming. Each unit represents how much DMG is earned per * point */ function dmgGrowthCoefficient() external view returns (uint); /** * @return The amount of points that the provided token earns for each unit of token deposited. Defaults to `1` * if the provided `token` does not exist or does not have a special weight. This number is `2` decimals. */ function getRewardPointsByToken(address token) external view returns (uint16); /** * @return The number of decimals that the underlying token has. */ function getTokenDecimalsByToken(address token) external view returns (uint8); /** * @return The index into the array returned from `getFarmTokens`, plus 1. 0 if the token isn't found. If the * index returned is non-zero, subtract 1 from it to get the real index into the array. */ function getTokenIndexPlusOneByToken(address token) external view returns (uint); // //////////////////// // User Functions // //////////////////// /** * Approves the spender from `msg.sender` to transfer funds into the contract on the user's behalf. If `isTrusted` * is marked as false, removes the spender. */ function approve(address spender, bool isTrusted) external; /** * True if the `spender` can transfer tokens on the user's behalf to this contract. */ function isApproved(address user, address spender) external view returns (bool); /** * Begins a farm by transferring `amount` of `token` from `user` to this contract and adds it to the balance of * `user`. `user` must be either 1) msg.sender or 2) a wallet who has approved msg.sender as a proxy; else this * function reverts. `funder` must fit into the same criteria as `user`; else this function reverts */ function beginFarming(address user, address funder, address token, uint amount) external; /** * Ends a farm by transferring all of `token` deposited by `from` to `recipient`, from this contract, as well as * all earned DMG for farming `token` to `recipient`. `from` must be either 1) msg.sender or 2) an approved * proxy; else this function reverts. * * @return The amount of `token` withdrawn and the amount of DMG earned for farming. Both values are sent to * `recipient`. */ function endFarmingByToken(address from, address recipient, address token) external returns (uint, uint); /** * Withdraws all of `msg.sender`'s tokens from the farm to `recipient`. This function reverts if there is an active * farm. `user` must be either 1) msg.sender or 2) an approved proxy; else this function reverts. */ function withdrawAllWhenOutOfSeason(address user, address recipient) external; /** * Withdraws all of `user` `token` from the farm to `recipient`. This function reverts if there is an active farm and the token is NOT removed. * `user` must be either 1) msg.sender or 2) an approved proxy; else this function reverts. * * @return The amount of tokens sent to `recipient` */ function withdrawByTokenWhenOutOfSeason( address user, address recipient, address token ) external returns (uint); /** * @return The amount of DMG that this owner has earned in the active farm. If there are no active season, this * function returns `0`. */ function getRewardBalanceByOwner(address owner) external view returns (uint); /** * @return The amount of DMG that this owner has earned in the active farm for the provided token. If there is no * active season, this function returns `0`. */ function getRewardBalanceByOwnerAndToken(address owner, address token) external view returns (uint); /** * @return The amount of `token` that this owner has deposited into this contract. The user may withdraw this * non-zero balance by invoking `endFarming` or `endFarmingByToken` if there is an active farm. If there is * NO active farm, the user may withdraw his/her funds by invoking */ function balanceOf(address owner, address token) external view returns (uint); /** * @return The most recent timestamp at which the `owner` deposited `token` into the yield farming contract for * the current season. If there is no active season, this function returns `0`. */ function getMostRecentDepositTimestampByOwnerAndToken(address owner, address token) external view returns (uint64); /** * @return The most recent indexed amount of DMG earned by the `owner` for the deposited `token` which is being * farmed for the most-recent season. If there is no active season, this function returns `0`. */ function getMostRecentIndexedDmgEarnedByOwnerAndToken(address owner, address token) external view returns (uint); }
/** * The interface for DMG "Yield Farming" - A process through which users may earn DMG by locking up their mTokens in * Uniswap pools, and staking the Uniswap pool's equity token in this contract. * * Yield farming in the DMM Ecosystem entails "rotation periods" in which a season is active, in order to incentivize * deposits of underlying tokens into the protocol. */
NatSpecMultiLine
getRewardPointsByToken
function getRewardPointsByToken(address token) external view returns (uint16);
/** * @return The amount of points that the provided token earns for each unit of token deposited. Defaults to `1` * if the provided `token` does not exist or does not have a special weight. This number is `2` decimals. */
NatSpecMultiLine
v0.5.13+commit.5b0b510c
Apache-2.0
bzzr://109d8c35d03b8ade3d7a4b4f689a030d34e0cce256c34dbd0f4a6b95b7701a2e
{ "func_code_index": [ 5413, 5496 ] }
2,405
DMGYieldFarmingRouter
contracts/external/farming/v1/IDMGYieldFarmingV1.sol
0x85455fc1428ceee0072309f87a227d53783ba6a8
Solidity
IDMGYieldFarmingV1
interface IDMGYieldFarmingV1 { // //////////////////// // Events // //////////////////// event GlobalProxySet(address indexed proxy, bool isTrusted); event TokenAdded(address indexed token, address indexed underlyingToken, uint8 underlyingTokenDecimals, uint16 points); event TokenRemoved(address indexed token); event FarmSeasonBegun(uint indexed seasonIndex, uint dmgAmount); event FarmSeasonEnd(uint indexed seasonIndex, address dustRecipient, uint dustyDmgAmount); event DmgGrowthCoefficientSet(uint coefficient); event RewardPointsSet(address indexed token, uint16 points); event Approval(address indexed user, address indexed spender, bool isTrusted); event BeginFarming(address indexed owner, address indexed token, uint depositedAmount); event EndFarming(address indexed owner, address indexed token, uint withdrawnAmount, uint earnedDmgAmount); event WithdrawOutOfSeason(address indexed owner, address indexed token, address indexed recipient, uint amount); // //////////////////// // Admin Functions // //////////////////// /** * Sets the `proxy` as a trusted contract, allowing it to interact with the user, on the user's behalf. * * @param proxy The address that can interact on the user's behalf. * @param isTrusted True if the proxy is trusted or false if it's not (should be removed). */ function approveGloballyTrustedProxy(address proxy, bool isTrusted) external; /** * @return true if the provided `proxy` is globally trusted and may interact with the yield farming contract on a * user's behalf or false otherwise. */ function isGloballyTrustedProxy(address proxy) external view returns (bool); /** * @param token The address of the token to be supported for farming. * @param underlyingToken The token to which this token is pegged. IE a Uniswap-V2 LP equity token for * DAI-mDAI has an underlying token of DAI. * @param underlyingTokenDecimals The number of decimals that the `underlyingToken` has. * @param points The amount of reward points for the provided token. */ function addAllowableToken(address token, address underlyingToken, uint8 underlyingTokenDecimals, uint16 points) external; /** * @param token The address of the token that will be removed from farming. */ function removeAllowableToken(address token) external; /** * Changes the reward points for the provided token. Reward points are a weighting system that enables certain * tokens to accrue DMG faster than others, allowing the protocol to prioritize certain deposits. */ function setRewardPointsByToken(address token, uint16 points) external; /** * Sets the DMG growth coefficient to use the new parameter provided. This variable is used to define how much * DMG is earned every second, for each point accrued. */ function setDmgGrowthCoefficient(uint dmgGrowthCoefficient) external; /** * Begins the farming process so users that accumulate DMG by locking tokens can start for this rotation. Calling * this function increments the currentSeasonIndex, starting a new season. This function reverts if there is * already an active season. * * @param dmgAmount The amount of DMG that will be used to fund this campaign. */ function beginFarmingSeason(uint dmgAmount) external; /** * Ends the active farming process if the admin calls this function. Otherwise, anyone may call this function once * all DMG have been drained from the contract. * * @param dustRecipient The recipient of any leftover DMG in this contract, when the campaign finishes. */ function endActiveFarmingSeason(address dustRecipient) external; // //////////////////// // Misc Functions // //////////////////// /** * @return The tokens that the farm supports. */ function getFarmTokens() external view returns (address[] memory); /** * @return True if the provided token is supported for farming, or false if it's not. */ function isSupportedToken(address token) external view returns (bool); /** * @return True if there is an active season for farming, or false if there isn't one. */ function isFarmActive() external view returns (bool); /** * The address that acts as a "secondary" owner with quicker access to function calling than the owner. Typically, * this is the DMMF. */ function guardian() external view returns (address); /** * @return The DMG token. */ function dmgToken() external view returns (address); /** * @return The growth coefficient for earning DMG while farming. Each unit represents how much DMG is earned per * point */ function dmgGrowthCoefficient() external view returns (uint); /** * @return The amount of points that the provided token earns for each unit of token deposited. Defaults to `1` * if the provided `token` does not exist or does not have a special weight. This number is `2` decimals. */ function getRewardPointsByToken(address token) external view returns (uint16); /** * @return The number of decimals that the underlying token has. */ function getTokenDecimalsByToken(address token) external view returns (uint8); /** * @return The index into the array returned from `getFarmTokens`, plus 1. 0 if the token isn't found. If the * index returned is non-zero, subtract 1 from it to get the real index into the array. */ function getTokenIndexPlusOneByToken(address token) external view returns (uint); // //////////////////// // User Functions // //////////////////// /** * Approves the spender from `msg.sender` to transfer funds into the contract on the user's behalf. If `isTrusted` * is marked as false, removes the spender. */ function approve(address spender, bool isTrusted) external; /** * True if the `spender` can transfer tokens on the user's behalf to this contract. */ function isApproved(address user, address spender) external view returns (bool); /** * Begins a farm by transferring `amount` of `token` from `user` to this contract and adds it to the balance of * `user`. `user` must be either 1) msg.sender or 2) a wallet who has approved msg.sender as a proxy; else this * function reverts. `funder` must fit into the same criteria as `user`; else this function reverts */ function beginFarming(address user, address funder, address token, uint amount) external; /** * Ends a farm by transferring all of `token` deposited by `from` to `recipient`, from this contract, as well as * all earned DMG for farming `token` to `recipient`. `from` must be either 1) msg.sender or 2) an approved * proxy; else this function reverts. * * @return The amount of `token` withdrawn and the amount of DMG earned for farming. Both values are sent to * `recipient`. */ function endFarmingByToken(address from, address recipient, address token) external returns (uint, uint); /** * Withdraws all of `msg.sender`'s tokens from the farm to `recipient`. This function reverts if there is an active * farm. `user` must be either 1) msg.sender or 2) an approved proxy; else this function reverts. */ function withdrawAllWhenOutOfSeason(address user, address recipient) external; /** * Withdraws all of `user` `token` from the farm to `recipient`. This function reverts if there is an active farm and the token is NOT removed. * `user` must be either 1) msg.sender or 2) an approved proxy; else this function reverts. * * @return The amount of tokens sent to `recipient` */ function withdrawByTokenWhenOutOfSeason( address user, address recipient, address token ) external returns (uint); /** * @return The amount of DMG that this owner has earned in the active farm. If there are no active season, this * function returns `0`. */ function getRewardBalanceByOwner(address owner) external view returns (uint); /** * @return The amount of DMG that this owner has earned in the active farm for the provided token. If there is no * active season, this function returns `0`. */ function getRewardBalanceByOwnerAndToken(address owner, address token) external view returns (uint); /** * @return The amount of `token` that this owner has deposited into this contract. The user may withdraw this * non-zero balance by invoking `endFarming` or `endFarmingByToken` if there is an active farm. If there is * NO active farm, the user may withdraw his/her funds by invoking */ function balanceOf(address owner, address token) external view returns (uint); /** * @return The most recent timestamp at which the `owner` deposited `token` into the yield farming contract for * the current season. If there is no active season, this function returns `0`. */ function getMostRecentDepositTimestampByOwnerAndToken(address owner, address token) external view returns (uint64); /** * @return The most recent indexed amount of DMG earned by the `owner` for the deposited `token` which is being * farmed for the most-recent season. If there is no active season, this function returns `0`. */ function getMostRecentIndexedDmgEarnedByOwnerAndToken(address owner, address token) external view returns (uint); }
/** * The interface for DMG "Yield Farming" - A process through which users may earn DMG by locking up their mTokens in * Uniswap pools, and staking the Uniswap pool's equity token in this contract. * * Yield farming in the DMM Ecosystem entails "rotation periods" in which a season is active, in order to incentivize * deposits of underlying tokens into the protocol. */
NatSpecMultiLine
getTokenDecimalsByToken
function getTokenDecimalsByToken(address token) external view returns (uint8);
/** * @return The number of decimals that the underlying token has. */
NatSpecMultiLine
v0.5.13+commit.5b0b510c
Apache-2.0
bzzr://109d8c35d03b8ade3d7a4b4f689a030d34e0cce256c34dbd0f4a6b95b7701a2e
{ "func_code_index": [ 5588, 5671 ] }
2,406