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
PrizeFlush
@pooltogether/v4-core/contracts/interfaces/IReserve.sol
0x2193b28b2bdfbf805506c9d91ed2021ba6fbc888
Solidity
IReserve
interface IReserve { /** * @notice Emit when checkpoint is created. * @param reserveAccumulated Total depsosited * @param withdrawAccumulated Total withdrawn */ event Checkpoint(uint256 reserveAccumulated, uint256 withdrawAccumulated); /** * @notice Emit when the withdrawTo function has executed. * @param recipient Address receiving funds * @param amount Amount of tokens transfered. */ event Withdrawn(address indexed recipient, uint256 amount); /** * @notice Create observation checkpoint in ring bufferr. * @dev Calculates total desposited tokens since last checkpoint and creates new accumulator checkpoint. */ function checkpoint() external; /** * @notice Read global token value. * @return IERC20 */ function getToken() external view returns (IERC20); /** * @notice Calculate token accumulation beween timestamp range. * @dev Search the ring buffer for two checkpoint observations and diffs accumulator amount. * @param startTimestamp Account address * @param endTimestamp Transfer amount */ function getReserveAccumulatedBetween(uint32 startTimestamp, uint32 endTimestamp) external returns (uint224); /** * @notice Transfer Reserve token balance to recipient address. * @dev Creates checkpoint before token transfer. Increments withdrawAccumulator with amount. * @param recipient Account address * @param amount Transfer amount */ function withdrawTo(address recipient, uint256 amount) external; }
checkpoint
function checkpoint() external;
/** * @notice Create observation checkpoint in ring bufferr. * @dev Calculates total desposited tokens since last checkpoint and creates new accumulator checkpoint. */
NatSpecMultiLine
v0.8.6+commit.11564f7e
GNU GPLv3
{ "func_code_index": [ 701, 736 ] }
5,700
PrizeFlush
@pooltogether/v4-core/contracts/interfaces/IReserve.sol
0x2193b28b2bdfbf805506c9d91ed2021ba6fbc888
Solidity
IReserve
interface IReserve { /** * @notice Emit when checkpoint is created. * @param reserveAccumulated Total depsosited * @param withdrawAccumulated Total withdrawn */ event Checkpoint(uint256 reserveAccumulated, uint256 withdrawAccumulated); /** * @notice Emit when the withdrawTo function has executed. * @param recipient Address receiving funds * @param amount Amount of tokens transfered. */ event Withdrawn(address indexed recipient, uint256 amount); /** * @notice Create observation checkpoint in ring bufferr. * @dev Calculates total desposited tokens since last checkpoint and creates new accumulator checkpoint. */ function checkpoint() external; /** * @notice Read global token value. * @return IERC20 */ function getToken() external view returns (IERC20); /** * @notice Calculate token accumulation beween timestamp range. * @dev Search the ring buffer for two checkpoint observations and diffs accumulator amount. * @param startTimestamp Account address * @param endTimestamp Transfer amount */ function getReserveAccumulatedBetween(uint32 startTimestamp, uint32 endTimestamp) external returns (uint224); /** * @notice Transfer Reserve token balance to recipient address. * @dev Creates checkpoint before token transfer. Increments withdrawAccumulator with amount. * @param recipient Account address * @param amount Transfer amount */ function withdrawTo(address recipient, uint256 amount) external; }
getToken
function getToken() external view returns (IERC20);
/** * @notice Read global token value. * @return IERC20 */
NatSpecMultiLine
v0.8.6+commit.11564f7e
GNU GPLv3
{ "func_code_index": [ 816, 871 ] }
5,701
PrizeFlush
@pooltogether/v4-core/contracts/interfaces/IReserve.sol
0x2193b28b2bdfbf805506c9d91ed2021ba6fbc888
Solidity
IReserve
interface IReserve { /** * @notice Emit when checkpoint is created. * @param reserveAccumulated Total depsosited * @param withdrawAccumulated Total withdrawn */ event Checkpoint(uint256 reserveAccumulated, uint256 withdrawAccumulated); /** * @notice Emit when the withdrawTo function has executed. * @param recipient Address receiving funds * @param amount Amount of tokens transfered. */ event Withdrawn(address indexed recipient, uint256 amount); /** * @notice Create observation checkpoint in ring bufferr. * @dev Calculates total desposited tokens since last checkpoint and creates new accumulator checkpoint. */ function checkpoint() external; /** * @notice Read global token value. * @return IERC20 */ function getToken() external view returns (IERC20); /** * @notice Calculate token accumulation beween timestamp range. * @dev Search the ring buffer for two checkpoint observations and diffs accumulator amount. * @param startTimestamp Account address * @param endTimestamp Transfer amount */ function getReserveAccumulatedBetween(uint32 startTimestamp, uint32 endTimestamp) external returns (uint224); /** * @notice Transfer Reserve token balance to recipient address. * @dev Creates checkpoint before token transfer. Increments withdrawAccumulator with amount. * @param recipient Account address * @param amount Transfer amount */ function withdrawTo(address recipient, uint256 amount) external; }
getReserveAccumulatedBetween
function getReserveAccumulatedBetween(uint32 startTimestamp, uint32 endTimestamp) external returns (uint224);
/** * @notice Calculate token accumulation beween timestamp range. * @dev Search the ring buffer for two checkpoint observations and diffs accumulator amount. * @param startTimestamp Account address * @param endTimestamp Transfer amount */
NatSpecMultiLine
v0.8.6+commit.11564f7e
GNU GPLv3
{ "func_code_index": [ 1147, 1276 ] }
5,702
PrizeFlush
@pooltogether/v4-core/contracts/interfaces/IReserve.sol
0x2193b28b2bdfbf805506c9d91ed2021ba6fbc888
Solidity
IReserve
interface IReserve { /** * @notice Emit when checkpoint is created. * @param reserveAccumulated Total depsosited * @param withdrawAccumulated Total withdrawn */ event Checkpoint(uint256 reserveAccumulated, uint256 withdrawAccumulated); /** * @notice Emit when the withdrawTo function has executed. * @param recipient Address receiving funds * @param amount Amount of tokens transfered. */ event Withdrawn(address indexed recipient, uint256 amount); /** * @notice Create observation checkpoint in ring bufferr. * @dev Calculates total desposited tokens since last checkpoint and creates new accumulator checkpoint. */ function checkpoint() external; /** * @notice Read global token value. * @return IERC20 */ function getToken() external view returns (IERC20); /** * @notice Calculate token accumulation beween timestamp range. * @dev Search the ring buffer for two checkpoint observations and diffs accumulator amount. * @param startTimestamp Account address * @param endTimestamp Transfer amount */ function getReserveAccumulatedBetween(uint32 startTimestamp, uint32 endTimestamp) external returns (uint224); /** * @notice Transfer Reserve token balance to recipient address. * @dev Creates checkpoint before token transfer. Increments withdrawAccumulator with amount. * @param recipient Account address * @param amount Transfer amount */ function withdrawTo(address recipient, uint256 amount) external; }
withdrawTo
function withdrawTo(address recipient, uint256 amount) external;
/** * @notice Transfer Reserve token balance to recipient address. * @dev Creates checkpoint before token transfer. Increments withdrawAccumulator with amount. * @param recipient Account address * @param amount Transfer amount */
NatSpecMultiLine
v0.8.6+commit.11564f7e
GNU GPLv3
{ "func_code_index": [ 1543, 1611 ] }
5,703
PrizeFlush
@pooltogether/v4-core/contracts/interfaces/IStrategy.sol
0x2193b28b2bdfbf805506c9d91ed2021ba6fbc888
Solidity
IStrategy
interface IStrategy { /** * @notice Emit when a strategy captures award amount from PrizePool. * @param totalPrizeCaptured Total prize captured from the PrizePool */ event Distributed(uint256 totalPrizeCaptured); /** * @notice Capture the award balance and distribute to prize splits. * @dev Permissionless function to initialize distribution of interst * @return Prize captured from PrizePool */ function distribute() external returns (uint256); }
distribute
function distribute() external returns (uint256);
/** * @notice Capture the award balance and distribute to prize splits. * @dev Permissionless function to initialize distribution of interst * @return Prize captured from PrizePool */
NatSpecMultiLine
v0.8.6+commit.11564f7e
GNU GPLv3
{ "func_code_index": [ 449, 502 ] }
5,704
DSToken
solidity/contracts/utility/Owned.sol
0xa78a391a060b3b904eba36e4f28b97d86ce0548a
Solidity
Owned
contract Owned is IOwned { address public override owner; address public newOwner; /** * @dev triggered when the owner is updated * * @param _prevOwner previous owner * @param _newOwner new owner */ event OwnerUpdate(address indexed _prevOwner, address indexed _newOwner); /** * @dev initializes a new Owned instance */ constructor() public { owner = msg.sender; } // allows execution by the owner only modifier ownerOnly { _ownerOnly(); _; } // error message binary size optimization function _ownerOnly() internal view { require(msg.sender == owner, "ERR_ACCESS_DENIED"); } /** * @dev allows transferring the contract ownership * the new owner still needs to accept the transfer * can only be called by the contract owner * * @param _newOwner new contract owner */ function transferOwnership(address _newOwner) public override ownerOnly { require(_newOwner != owner, "ERR_SAME_OWNER"); newOwner = _newOwner; } /** * @dev used by a new owner to accept an ownership transfer */ function acceptOwnership() override public { require(msg.sender == newOwner, "ERR_ACCESS_DENIED"); emit OwnerUpdate(owner, newOwner); owner = newOwner; newOwner = address(0); } }
/** * @dev Provides support and utilities for contract ownership */
NatSpecMultiLine
_ownerOnly
function _ownerOnly() internal view { require(msg.sender == owner, "ERR_ACCESS_DENIED"); }
// error message binary size optimization
LineComment
v0.6.12+commit.27d51765
None
ipfs://3442b0030f95c9b0d8d1afedc1ca252936bd53ca32379f17ce8ae61e96df9ee6
{ "func_code_index": [ 622, 731 ] }
5,705
DSToken
solidity/contracts/utility/Owned.sol
0xa78a391a060b3b904eba36e4f28b97d86ce0548a
Solidity
Owned
contract Owned is IOwned { address public override owner; address public newOwner; /** * @dev triggered when the owner is updated * * @param _prevOwner previous owner * @param _newOwner new owner */ event OwnerUpdate(address indexed _prevOwner, address indexed _newOwner); /** * @dev initializes a new Owned instance */ constructor() public { owner = msg.sender; } // allows execution by the owner only modifier ownerOnly { _ownerOnly(); _; } // error message binary size optimization function _ownerOnly() internal view { require(msg.sender == owner, "ERR_ACCESS_DENIED"); } /** * @dev allows transferring the contract ownership * the new owner still needs to accept the transfer * can only be called by the contract owner * * @param _newOwner new contract owner */ function transferOwnership(address _newOwner) public override ownerOnly { require(_newOwner != owner, "ERR_SAME_OWNER"); newOwner = _newOwner; } /** * @dev used by a new owner to accept an ownership transfer */ function acceptOwnership() override public { require(msg.sender == newOwner, "ERR_ACCESS_DENIED"); emit OwnerUpdate(owner, newOwner); owner = newOwner; newOwner = address(0); } }
/** * @dev Provides support and utilities for contract ownership */
NatSpecMultiLine
transferOwnership
function transferOwnership(address _newOwner) public override ownerOnly { require(_newOwner != owner, "ERR_SAME_OWNER"); newOwner = _newOwner; }
/** * @dev allows transferring the contract ownership * the new owner still needs to accept the transfer * can only be called by the contract owner * * @param _newOwner new contract owner */
NatSpecMultiLine
v0.6.12+commit.27d51765
None
ipfs://3442b0030f95c9b0d8d1afedc1ca252936bd53ca32379f17ce8ae61e96df9ee6
{ "func_code_index": [ 973, 1145 ] }
5,706
DSToken
solidity/contracts/utility/Owned.sol
0xa78a391a060b3b904eba36e4f28b97d86ce0548a
Solidity
Owned
contract Owned is IOwned { address public override owner; address public newOwner; /** * @dev triggered when the owner is updated * * @param _prevOwner previous owner * @param _newOwner new owner */ event OwnerUpdate(address indexed _prevOwner, address indexed _newOwner); /** * @dev initializes a new Owned instance */ constructor() public { owner = msg.sender; } // allows execution by the owner only modifier ownerOnly { _ownerOnly(); _; } // error message binary size optimization function _ownerOnly() internal view { require(msg.sender == owner, "ERR_ACCESS_DENIED"); } /** * @dev allows transferring the contract ownership * the new owner still needs to accept the transfer * can only be called by the contract owner * * @param _newOwner new contract owner */ function transferOwnership(address _newOwner) public override ownerOnly { require(_newOwner != owner, "ERR_SAME_OWNER"); newOwner = _newOwner; } /** * @dev used by a new owner to accept an ownership transfer */ function acceptOwnership() override public { require(msg.sender == newOwner, "ERR_ACCESS_DENIED"); emit OwnerUpdate(owner, newOwner); owner = newOwner; newOwner = address(0); } }
/** * @dev Provides support and utilities for contract ownership */
NatSpecMultiLine
acceptOwnership
function acceptOwnership() override public { require(msg.sender == newOwner, "ERR_ACCESS_DENIED"); emit OwnerUpdate(owner, newOwner); owner = newOwner; newOwner = address(0); }
/** * @dev used by a new owner to accept an ownership transfer */
NatSpecMultiLine
v0.6.12+commit.27d51765
None
ipfs://3442b0030f95c9b0d8d1afedc1ca252936bd53ca32379f17ce8ae61e96df9ee6
{ "func_code_index": [ 1231, 1453 ] }
5,707
TulipWhiteToken
TulipWhiteToken.sol
0xbb13b668fa4a9cf89c601997355d759b0f7799a9
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; } }
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.14+commit.c2215d46
bzzr://0403ffd9daf1d73233badf0f38e13e7ccbbd26d9d342ea8dc60d458da4bf931a
{ "func_code_index": [ 89, 272 ] }
5,708
TulipWhiteToken
TulipWhiteToken.sol
0xbb13b668fa4a9cf89c601997355d759b0f7799a9
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; } }
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.14+commit.c2215d46
bzzr://0403ffd9daf1d73233badf0f38e13e7ccbbd26d9d342ea8dc60d458da4bf931a
{ "func_code_index": [ 356, 629 ] }
5,709
TulipWhiteToken
TulipWhiteToken.sol
0xbb13b668fa4a9cf89c601997355d759b0f7799a9
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; } }
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.14+commit.c2215d46
bzzr://0403ffd9daf1d73233badf0f38e13e7ccbbd26d9d342ea8dc60d458da4bf931a
{ "func_code_index": [ 744, 860 ] }
5,710
TulipWhiteToken
TulipWhiteToken.sol
0xbb13b668fa4a9cf89c601997355d759b0f7799a9
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; } }
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.14+commit.c2215d46
bzzr://0403ffd9daf1d73233badf0f38e13e7ccbbd26d9d342ea8dc60d458da4bf931a
{ "func_code_index": [ 924, 1060 ] }
5,711
TulipWhiteToken
TulipWhiteToken.sol
0xbb13b668fa4a9cf89c601997355d759b0f7799a9
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.14+commit.c2215d46
bzzr://0403ffd9daf1d73233badf0f38e13e7ccbbd26d9d342ea8dc60d458da4bf931a
{ "func_code_index": [ 199, 287 ] }
5,712
TulipWhiteToken
TulipWhiteToken.sol
0xbb13b668fa4a9cf89c601997355d759b0f7799a9
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.14+commit.c2215d46
bzzr://0403ffd9daf1d73233badf0f38e13e7ccbbd26d9d342ea8dc60d458da4bf931a
{ "func_code_index": [ 445, 836 ] }
5,713
TulipWhiteToken
TulipWhiteToken.sol
0xbb13b668fa4a9cf89c601997355d759b0f7799a9
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.14+commit.c2215d46
bzzr://0403ffd9daf1d73233badf0f38e13e7ccbbd26d9d342ea8dc60d458da4bf931a
{ "func_code_index": [ 1042, 1154 ] }
5,714
TulipWhiteToken
TulipWhiteToken.sol
0xbb13b668fa4a9cf89c601997355d759b0f7799a9
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.14+commit.c2215d46
bzzr://0403ffd9daf1d73233badf0f38e13e7ccbbd26d9d342ea8dc60d458da4bf931a
{ "func_code_index": [ 401, 853 ] }
5,715
TulipWhiteToken
TulipWhiteToken.sol
0xbb13b668fa4a9cf89c601997355d759b0f7799a9
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.14+commit.c2215d46
bzzr://0403ffd9daf1d73233badf0f38e13e7ccbbd26d9d342ea8dc60d458da4bf931a
{ "func_code_index": [ 1485, 1675 ] }
5,716
TulipWhiteToken
TulipWhiteToken.sol
0xbb13b668fa4a9cf89c601997355d759b0f7799a9
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.14+commit.c2215d46
bzzr://0403ffd9daf1d73233badf0f38e13e7ccbbd26d9d342ea8dc60d458da4bf931a
{ "func_code_index": [ 1999, 2130 ] }
5,717
TulipWhiteToken
TulipWhiteToken.sol
0xbb13b668fa4a9cf89c601997355d759b0f7799a9
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.14+commit.c2215d46
bzzr://0403ffd9daf1d73233badf0f38e13e7ccbbd26d9d342ea8dc60d458da4bf931a
{ "func_code_index": [ 2596, 2860 ] }
5,718
TulipWhiteToken
TulipWhiteToken.sol
0xbb13b668fa4a9cf89c601997355d759b0f7799a9
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.14+commit.c2215d46
bzzr://0403ffd9daf1d73233badf0f38e13e7ccbbd26d9d342ea8dc60d458da4bf931a
{ "func_code_index": [ 3331, 3741 ] }
5,719
TulipWhiteToken
TulipWhiteToken.sol
0xbb13b668fa4a9cf89c601997355d759b0f7799a9
Solidity
TulipWhiteToken
contract TulipWhiteToken is StandardToken { string public constant name = "TulipWhiteToken"; // solium-disable-line uppercase string public constant symbol = "TLPW"; // solium-disable-line uppercase uint256 public constant INITIAL_SUPPLY = 800000; // contract owner address public owner; /** * @dev Constructor that gives msg.sender all of existing tokens. */ function TulipWhiteToken() public { owner = msg.sender; totalSupply_ = INITIAL_SUPPLY; balances[msg.sender] = INITIAL_SUPPLY; Transfer(0x0, msg.sender, INITIAL_SUPPLY); } }
TulipWhiteToken
function TulipWhiteToken() public { owner = msg.sender; totalSupply_ = INITIAL_SUPPLY; balances[msg.sender] = INITIAL_SUPPLY; Transfer(0x0, msg.sender, INITIAL_SUPPLY); }
/** * @dev Constructor that gives msg.sender all of existing tokens. */
NatSpecMultiLine
v0.4.14+commit.c2215d46
bzzr://0403ffd9daf1d73233badf0f38e13e7ccbbd26d9d342ea8dc60d458da4bf931a
{ "func_code_index": [ 405, 621 ] }
5,720
PrizeFlush
@pooltogether/v4-periphery/contracts/interfaces/IPrizeFlush.sol
0x2193b28b2bdfbf805506c9d91ed2021ba6fbc888
Solidity
IPrizeFlush
interface IPrizeFlush { /** * @notice Emit when the flush function has executed. * @param destination Address receiving funds * @param amount Amount of tokens transferred */ event Flushed(address indexed destination, uint256 amount); /** * @notice Emit when destination is set. * @param destination Destination address */ event DestinationSet(address destination); /** * @notice Emit when strategy is set. * @param strategy Strategy address */ event StrategySet(IStrategy strategy); /** * @notice Emit when reserve is set. * @param reserve Reserve address */ event ReserveSet(IReserve reserve); /// @notice Read global destination variable. function getDestination() external view returns (address); /// @notice Read global reserve variable. function getReserve() external view returns (IReserve); /// @notice Read global strategy variable. function getStrategy() external view returns (IStrategy); /// @notice Set global destination variable. function setDestination(address _destination) external returns (address); /// @notice Set global reserve variable. function setReserve(IReserve _reserve) external returns (IReserve); /// @notice Set global strategy variable. function setStrategy(IStrategy _strategy) external returns (IStrategy); /** * @notice Migrate interest from PrizePool to PrizeDistributor in a single transaction. * @dev Captures interest, checkpoint data and transfers tokens to final destination. * @return True if operation is successful. */ function flush() external returns (bool); }
getDestination
function getDestination() external view returns (address);
/// @notice Read global destination variable.
NatSpecSingleLine
v0.8.6+commit.11564f7e
GNU GPLv3
{ "func_code_index": [ 751, 813 ] }
5,721
PrizeFlush
@pooltogether/v4-periphery/contracts/interfaces/IPrizeFlush.sol
0x2193b28b2bdfbf805506c9d91ed2021ba6fbc888
Solidity
IPrizeFlush
interface IPrizeFlush { /** * @notice Emit when the flush function has executed. * @param destination Address receiving funds * @param amount Amount of tokens transferred */ event Flushed(address indexed destination, uint256 amount); /** * @notice Emit when destination is set. * @param destination Destination address */ event DestinationSet(address destination); /** * @notice Emit when strategy is set. * @param strategy Strategy address */ event StrategySet(IStrategy strategy); /** * @notice Emit when reserve is set. * @param reserve Reserve address */ event ReserveSet(IReserve reserve); /// @notice Read global destination variable. function getDestination() external view returns (address); /// @notice Read global reserve variable. function getReserve() external view returns (IReserve); /// @notice Read global strategy variable. function getStrategy() external view returns (IStrategy); /// @notice Set global destination variable. function setDestination(address _destination) external returns (address); /// @notice Set global reserve variable. function setReserve(IReserve _reserve) external returns (IReserve); /// @notice Set global strategy variable. function setStrategy(IStrategy _strategy) external returns (IStrategy); /** * @notice Migrate interest from PrizePool to PrizeDistributor in a single transaction. * @dev Captures interest, checkpoint data and transfers tokens to final destination. * @return True if operation is successful. */ function flush() external returns (bool); }
getReserve
function getReserve() external view returns (IReserve);
/// @notice Read global reserve variable.
NatSpecSingleLine
v0.8.6+commit.11564f7e
GNU GPLv3
{ "func_code_index": [ 861, 920 ] }
5,722
PrizeFlush
@pooltogether/v4-periphery/contracts/interfaces/IPrizeFlush.sol
0x2193b28b2bdfbf805506c9d91ed2021ba6fbc888
Solidity
IPrizeFlush
interface IPrizeFlush { /** * @notice Emit when the flush function has executed. * @param destination Address receiving funds * @param amount Amount of tokens transferred */ event Flushed(address indexed destination, uint256 amount); /** * @notice Emit when destination is set. * @param destination Destination address */ event DestinationSet(address destination); /** * @notice Emit when strategy is set. * @param strategy Strategy address */ event StrategySet(IStrategy strategy); /** * @notice Emit when reserve is set. * @param reserve Reserve address */ event ReserveSet(IReserve reserve); /// @notice Read global destination variable. function getDestination() external view returns (address); /// @notice Read global reserve variable. function getReserve() external view returns (IReserve); /// @notice Read global strategy variable. function getStrategy() external view returns (IStrategy); /// @notice Set global destination variable. function setDestination(address _destination) external returns (address); /// @notice Set global reserve variable. function setReserve(IReserve _reserve) external returns (IReserve); /// @notice Set global strategy variable. function setStrategy(IStrategy _strategy) external returns (IStrategy); /** * @notice Migrate interest from PrizePool to PrizeDistributor in a single transaction. * @dev Captures interest, checkpoint data and transfers tokens to final destination. * @return True if operation is successful. */ function flush() external returns (bool); }
getStrategy
function getStrategy() external view returns (IStrategy);
/// @notice Read global strategy variable.
NatSpecSingleLine
v0.8.6+commit.11564f7e
GNU GPLv3
{ "func_code_index": [ 969, 1030 ] }
5,723
PrizeFlush
@pooltogether/v4-periphery/contracts/interfaces/IPrizeFlush.sol
0x2193b28b2bdfbf805506c9d91ed2021ba6fbc888
Solidity
IPrizeFlush
interface IPrizeFlush { /** * @notice Emit when the flush function has executed. * @param destination Address receiving funds * @param amount Amount of tokens transferred */ event Flushed(address indexed destination, uint256 amount); /** * @notice Emit when destination is set. * @param destination Destination address */ event DestinationSet(address destination); /** * @notice Emit when strategy is set. * @param strategy Strategy address */ event StrategySet(IStrategy strategy); /** * @notice Emit when reserve is set. * @param reserve Reserve address */ event ReserveSet(IReserve reserve); /// @notice Read global destination variable. function getDestination() external view returns (address); /// @notice Read global reserve variable. function getReserve() external view returns (IReserve); /// @notice Read global strategy variable. function getStrategy() external view returns (IStrategy); /// @notice Set global destination variable. function setDestination(address _destination) external returns (address); /// @notice Set global reserve variable. function setReserve(IReserve _reserve) external returns (IReserve); /// @notice Set global strategy variable. function setStrategy(IStrategy _strategy) external returns (IStrategy); /** * @notice Migrate interest from PrizePool to PrizeDistributor in a single transaction. * @dev Captures interest, checkpoint data and transfers tokens to final destination. * @return True if operation is successful. */ function flush() external returns (bool); }
setDestination
function setDestination(address _destination) external returns (address);
/// @notice Set global destination variable.
NatSpecSingleLine
v0.8.6+commit.11564f7e
GNU GPLv3
{ "func_code_index": [ 1081, 1158 ] }
5,724
PrizeFlush
@pooltogether/v4-periphery/contracts/interfaces/IPrizeFlush.sol
0x2193b28b2bdfbf805506c9d91ed2021ba6fbc888
Solidity
IPrizeFlush
interface IPrizeFlush { /** * @notice Emit when the flush function has executed. * @param destination Address receiving funds * @param amount Amount of tokens transferred */ event Flushed(address indexed destination, uint256 amount); /** * @notice Emit when destination is set. * @param destination Destination address */ event DestinationSet(address destination); /** * @notice Emit when strategy is set. * @param strategy Strategy address */ event StrategySet(IStrategy strategy); /** * @notice Emit when reserve is set. * @param reserve Reserve address */ event ReserveSet(IReserve reserve); /// @notice Read global destination variable. function getDestination() external view returns (address); /// @notice Read global reserve variable. function getReserve() external view returns (IReserve); /// @notice Read global strategy variable. function getStrategy() external view returns (IStrategy); /// @notice Set global destination variable. function setDestination(address _destination) external returns (address); /// @notice Set global reserve variable. function setReserve(IReserve _reserve) external returns (IReserve); /// @notice Set global strategy variable. function setStrategy(IStrategy _strategy) external returns (IStrategy); /** * @notice Migrate interest from PrizePool to PrizeDistributor in a single transaction. * @dev Captures interest, checkpoint data and transfers tokens to final destination. * @return True if operation is successful. */ function flush() external returns (bool); }
setReserve
function setReserve(IReserve _reserve) external returns (IReserve);
/// @notice Set global reserve variable.
NatSpecSingleLine
v0.8.6+commit.11564f7e
GNU GPLv3
{ "func_code_index": [ 1205, 1276 ] }
5,725
PrizeFlush
@pooltogether/v4-periphery/contracts/interfaces/IPrizeFlush.sol
0x2193b28b2bdfbf805506c9d91ed2021ba6fbc888
Solidity
IPrizeFlush
interface IPrizeFlush { /** * @notice Emit when the flush function has executed. * @param destination Address receiving funds * @param amount Amount of tokens transferred */ event Flushed(address indexed destination, uint256 amount); /** * @notice Emit when destination is set. * @param destination Destination address */ event DestinationSet(address destination); /** * @notice Emit when strategy is set. * @param strategy Strategy address */ event StrategySet(IStrategy strategy); /** * @notice Emit when reserve is set. * @param reserve Reserve address */ event ReserveSet(IReserve reserve); /// @notice Read global destination variable. function getDestination() external view returns (address); /// @notice Read global reserve variable. function getReserve() external view returns (IReserve); /// @notice Read global strategy variable. function getStrategy() external view returns (IStrategy); /// @notice Set global destination variable. function setDestination(address _destination) external returns (address); /// @notice Set global reserve variable. function setReserve(IReserve _reserve) external returns (IReserve); /// @notice Set global strategy variable. function setStrategy(IStrategy _strategy) external returns (IStrategy); /** * @notice Migrate interest from PrizePool to PrizeDistributor in a single transaction. * @dev Captures interest, checkpoint data and transfers tokens to final destination. * @return True if operation is successful. */ function flush() external returns (bool); }
setStrategy
function setStrategy(IStrategy _strategy) external returns (IStrategy);
/// @notice Set global strategy variable.
NatSpecSingleLine
v0.8.6+commit.11564f7e
GNU GPLv3
{ "func_code_index": [ 1324, 1399 ] }
5,726
PrizeFlush
@pooltogether/v4-periphery/contracts/interfaces/IPrizeFlush.sol
0x2193b28b2bdfbf805506c9d91ed2021ba6fbc888
Solidity
IPrizeFlush
interface IPrizeFlush { /** * @notice Emit when the flush function has executed. * @param destination Address receiving funds * @param amount Amount of tokens transferred */ event Flushed(address indexed destination, uint256 amount); /** * @notice Emit when destination is set. * @param destination Destination address */ event DestinationSet(address destination); /** * @notice Emit when strategy is set. * @param strategy Strategy address */ event StrategySet(IStrategy strategy); /** * @notice Emit when reserve is set. * @param reserve Reserve address */ event ReserveSet(IReserve reserve); /// @notice Read global destination variable. function getDestination() external view returns (address); /// @notice Read global reserve variable. function getReserve() external view returns (IReserve); /// @notice Read global strategy variable. function getStrategy() external view returns (IStrategy); /// @notice Set global destination variable. function setDestination(address _destination) external returns (address); /// @notice Set global reserve variable. function setReserve(IReserve _reserve) external returns (IReserve); /// @notice Set global strategy variable. function setStrategy(IStrategy _strategy) external returns (IStrategy); /** * @notice Migrate interest from PrizePool to PrizeDistributor in a single transaction. * @dev Captures interest, checkpoint data and transfers tokens to final destination. * @return True if operation is successful. */ function flush() external returns (bool); }
flush
function flush() external returns (bool);
/** * @notice Migrate interest from PrizePool to PrizeDistributor in a single transaction. * @dev Captures interest, checkpoint data and transfers tokens to final destination. * @return True if operation is successful. */
NatSpecMultiLine
v0.8.6+commit.11564f7e
GNU GPLv3
{ "func_code_index": [ 1650, 1695 ] }
5,727
FlashLiquidator
contracts/liquidator/Flash.sol
0x23d85060f87218bb276afe55a26bfd3b5f59914e
Solidity
CallbackValidation
library CallbackValidation { /// @notice Returns the address of a valid Uniswap V3 Pool /// @param factory The contract address of the Uniswap V3 factory /// @param tokenA The contract address of either token0 or token1 /// @param tokenB The contract address of the other token /// @param fee The fee collected upon every swap in the pool, denominated in hundredths of a bip /// @return pool The V3 pool contract address function verifyCallback( address factory, address tokenA, address tokenB, uint24 fee ) internal view returns (IUniswapV3Pool pool) { return verifyCallback(factory, PoolAddress.getPoolKey(tokenA, tokenB, fee)); } /// @notice Returns the address of a valid Uniswap V3 Pool /// @param factory The contract address of the Uniswap V3 factory /// @param poolKey The identifying key of the V3 pool /// @return pool The V3 pool contract address function verifyCallback(address factory, PoolAddress.PoolKey memory poolKey) internal view returns (IUniswapV3Pool pool) { pool = IUniswapV3Pool(PoolAddress.computeAddress(factory, poolKey)); require(msg.sender == address(pool)); } }
/// from 'uniswap/v3-periphery/contracts/libraries/CallbackValidation.sol'; /// @notice Provides validation for callbacks from Uniswap V3 Pools
NatSpecSingleLine
verifyCallback
function verifyCallback( address factory, address tokenA, address tokenB, uint24 fee ) internal view returns (IUniswapV3Pool pool) { return verifyCallback(factory, PoolAddress.getPoolKey(tokenA, tokenB, fee)); }
/// @notice Returns the address of a valid Uniswap V3 Pool /// @param factory The contract address of the Uniswap V3 factory /// @param tokenA The contract address of either token0 or token1 /// @param tokenB The contract address of the other token /// @param fee The fee collected upon every swap in the pool, denominated in hundredths of a bip /// @return pool The V3 pool contract address
NatSpecSingleLine
v0.8.6+commit.11564f7e
{ "func_code_index": [ 445, 708 ] }
5,728
FlashLiquidator
contracts/liquidator/Flash.sol
0x23d85060f87218bb276afe55a26bfd3b5f59914e
Solidity
CallbackValidation
library CallbackValidation { /// @notice Returns the address of a valid Uniswap V3 Pool /// @param factory The contract address of the Uniswap V3 factory /// @param tokenA The contract address of either token0 or token1 /// @param tokenB The contract address of the other token /// @param fee The fee collected upon every swap in the pool, denominated in hundredths of a bip /// @return pool The V3 pool contract address function verifyCallback( address factory, address tokenA, address tokenB, uint24 fee ) internal view returns (IUniswapV3Pool pool) { return verifyCallback(factory, PoolAddress.getPoolKey(tokenA, tokenB, fee)); } /// @notice Returns the address of a valid Uniswap V3 Pool /// @param factory The contract address of the Uniswap V3 factory /// @param poolKey The identifying key of the V3 pool /// @return pool The V3 pool contract address function verifyCallback(address factory, PoolAddress.PoolKey memory poolKey) internal view returns (IUniswapV3Pool pool) { pool = IUniswapV3Pool(PoolAddress.computeAddress(factory, poolKey)); require(msg.sender == address(pool)); } }
/// from 'uniswap/v3-periphery/contracts/libraries/CallbackValidation.sol'; /// @notice Provides validation for callbacks from Uniswap V3 Pools
NatSpecSingleLine
verifyCallback
function verifyCallback(address factory, PoolAddress.PoolKey memory poolKey) internal view returns (IUniswapV3Pool pool) { pool = IUniswapV3Pool(PoolAddress.computeAddress(factory, poolKey)); require(msg.sender == address(pool)); }
/// @notice Returns the address of a valid Uniswap V3 Pool /// @param factory The contract address of the Uniswap V3 factory /// @param poolKey The identifying key of the V3 pool /// @return pool The V3 pool contract address
NatSpecSingleLine
v0.8.6+commit.11564f7e
{ "func_code_index": [ 951, 1234 ] }
5,729
FlashLiquidator
contracts/liquidator/Flash.sol
0x23d85060f87218bb276afe55a26bfd3b5f59914e
Solidity
PoolAddress
library PoolAddress { bytes32 internal constant POOL_INIT_CODE_HASH = 0xe34f199b19b2b4f47f68442619d555527d244f78a3297ea89325f843f87b8b54; /// @notice The identifying key of the pool struct PoolKey { address token0; address token1; uint24 fee; } /// @notice Returns PoolKey: the ordered tokens with the matched fee levels /// @param tokenA The first token of a pool, unsorted /// @param tokenB The second token of a pool, unsorted /// @param fee The fee level of the pool /// @return Poolkey The pool details with ordered token0 and token1 assignments function getPoolKey( address tokenA, address tokenB, uint24 fee ) internal pure returns (PoolKey memory) { if (tokenA > tokenB) (tokenA, tokenB) = (tokenB, tokenA); return PoolKey({token0: tokenA, token1: tokenB, fee: fee}); } /// @notice Deterministically computes the pool address given the factory and PoolKey /// @param factory The Uniswap V3 factory contract address /// @param key The PoolKey /// @return pool The contract address of the V3 pool function computeAddress(address factory, PoolKey memory key) internal pure returns (address pool) { require(key.token0 < key.token1); pool = address( uint160(uint256( keccak256( abi.encodePacked( hex'ff', factory, keccak256(abi.encode(key.token0, key.token1, key.fee)), POOL_INIT_CODE_HASH ) ) )) ); } }
/// from 'uniswap/v3-periphery/contracts/libraries/PoolAddress.sol'; /// @title Provides functions for deriving a pool address from the factory, tokens, and the fee
NatSpecSingleLine
getPoolKey
function getPoolKey( address tokenA, address tokenB, uint24 fee ) internal pure returns (PoolKey memory) { if (tokenA > tokenB) (tokenA, tokenB) = (tokenB, tokenA); return PoolKey({token0: tokenA, token1: tokenB, fee: fee}); }
/// @notice Returns PoolKey: the ordered tokens with the matched fee levels /// @param tokenA The first token of a pool, unsorted /// @param tokenB The second token of a pool, unsorted /// @param fee The fee level of the pool /// @return Poolkey The pool details with ordered token0 and token1 assignments
NatSpecSingleLine
v0.8.6+commit.11564f7e
{ "func_code_index": [ 613, 891 ] }
5,730
FlashLiquidator
contracts/liquidator/Flash.sol
0x23d85060f87218bb276afe55a26bfd3b5f59914e
Solidity
PoolAddress
library PoolAddress { bytes32 internal constant POOL_INIT_CODE_HASH = 0xe34f199b19b2b4f47f68442619d555527d244f78a3297ea89325f843f87b8b54; /// @notice The identifying key of the pool struct PoolKey { address token0; address token1; uint24 fee; } /// @notice Returns PoolKey: the ordered tokens with the matched fee levels /// @param tokenA The first token of a pool, unsorted /// @param tokenB The second token of a pool, unsorted /// @param fee The fee level of the pool /// @return Poolkey The pool details with ordered token0 and token1 assignments function getPoolKey( address tokenA, address tokenB, uint24 fee ) internal pure returns (PoolKey memory) { if (tokenA > tokenB) (tokenA, tokenB) = (tokenB, tokenA); return PoolKey({token0: tokenA, token1: tokenB, fee: fee}); } /// @notice Deterministically computes the pool address given the factory and PoolKey /// @param factory The Uniswap V3 factory contract address /// @param key The PoolKey /// @return pool The contract address of the V3 pool function computeAddress(address factory, PoolKey memory key) internal pure returns (address pool) { require(key.token0 < key.token1); pool = address( uint160(uint256( keccak256( abi.encodePacked( hex'ff', factory, keccak256(abi.encode(key.token0, key.token1, key.fee)), POOL_INIT_CODE_HASH ) ) )) ); } }
/// from 'uniswap/v3-periphery/contracts/libraries/PoolAddress.sol'; /// @title Provides functions for deriving a pool address from the factory, tokens, and the fee
NatSpecSingleLine
computeAddress
function computeAddress(address factory, PoolKey memory key) internal pure returns (address pool) { require(key.token0 < key.token1); pool = address( uint160(uint256( keccak256( abi.encodePacked( hex'ff', factory, keccak256(abi.encode(key.token0, key.token1, key.fee)), POOL_INIT_CODE_HASH ) ) )) ); }
/// @notice Deterministically computes the pool address given the factory and PoolKey /// @param factory The Uniswap V3 factory contract address /// @param key The PoolKey /// @return pool The contract address of the V3 pool
NatSpecSingleLine
v0.8.6+commit.11564f7e
{ "func_code_index": [ 1134, 1659 ] }
5,731
EthereumMoon
EthereumMoon.sol
0xe094b159af7835dbe7f3b059639d66a963abbae4
Solidity
Context
contract Context { constructor() internal {} // solhint-disable-previous-line no-empty-blocks function _msgSender() internal view returns(address payable) { return msg.sender; } }
_msgSender
function _msgSender() internal view returns(address payable) { return msg.sender; }
// solhint-disable-previous-line no-empty-blocks
LineComment
v0.5.17+commit.d19bba13
None
bzzr://7841756fa9b96b22ac28e0ede93b98482bdaf876ac253760f7ef0dfa0a7f59ec
{ "func_code_index": [ 105, 207 ] }
5,732
Anastomos
Anastomos.sol
0xefacc9531c7749a637cd82fab6ac4b9f991c04b8
Solidity
Anastomos
contract Anastomos { /* Public variables of the token */ string public standard = 'Anastomos 0.1'; string public name; string public symbol; uint8 public decimals; 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); /* Initializes contract with initial supply tokens to the creator of the contract */ function Anastomos() { balanceOf[msg.sender] = 500000000 * 1000000000000000000; // Give the creator all initial tokens totalSupply = 500000000 * 1000000000000000000; // Update total supply name = "Anastomos"; // Set the name for display purposes symbol = "AT"; // Set the symbol for display purposes decimals = 18; // Amount of decimals for display purposes } /* Send coins */ function transfer(address _to, uint256 _value) { if (_to == 0x0) revert(); // Prevent transfer to 0x0 address. Use burn() instead if (balanceOf[msg.sender] < _value) revert(); // Check if the sender has enough if (balanceOf[_to] + _value < balanceOf[_to]) revert(); // Check for overflows balanceOf[msg.sender] -= _value; // Subtract from the sender balanceOf[_to] += _value; // Add the same to the recipient Transfer(msg.sender, _to, _value); // Notify anyone listening that this transfer took place } /* Allow another contract to spend some tokens in your behalf */ function approve(address _spender, uint256 _value) returns (bool success) { allowance[msg.sender][_spender] = _value; return true; } /* Approve and then communicate the approved contract in a single tx */ function approveAndCall(address _spender, uint256 _value, bytes _extraData) returns (bool success) { tokenRecipient spender = tokenRecipient(_spender); if (approve(_spender, _value)) { spender.receiveApproval(msg.sender, _value, this, _extraData); return true; } } /* A contract attempts to get the coins */ function transferFrom(address _from, address _to, uint256 _value) returns (bool success) { if (_to == 0x0) revert(); // Prevent transfer to 0x0 address. Use burn() instead if (balanceOf[_from] < _value) revert(); // Check if the sender has enough if (balanceOf[_to] + _value < balanceOf[_to]) revert(); // Check for overflows if (_value > allowance[_from][msg.sender]) revert(); // Check allowance balanceOf[_from] -= _value; // Subtract from the sender balanceOf[_to] += _value; // Add the same to the recipient allowance[_from][msg.sender] -= _value; Transfer(_from, _to, _value); return true; } function burn(uint256 _value) returns (bool success) { if (balanceOf[msg.sender] < _value) revert(); // Check if the sender has enough balanceOf[msg.sender] -= _value; // Subtract from the sender totalSupply -= _value; // Updates totalSupply Burn(msg.sender, _value); return true; } function burnFrom(address _from, uint256 _value) returns (bool success) { if (balanceOf[_from] < _value) revert(); // Check if the sender has enough if (_value > allowance[_from][msg.sender]) revert(); // Check allowance balanceOf[_from] -= _value; // Subtract from the sender totalSupply -= _value; // Updates totalSupply Burn(_from, _value); return true; } }
Anastomos
function Anastomos() { balanceOf[msg.sender] = 500000000 * 1000000000000000000; // Give the creator all initial tokens totalSupply = 500000000 * 1000000000000000000; // Update total supply name = "Anastomos"; // Set the name for display purposes symbol = "AT"; // Set the symbol for display purposes decimals = 18; // Amount of decimals for display purposes }
/* Initializes contract with initial supply tokens to the creator of the contract */
Comment
v0.4.13+commit.fb4cb1a
bzzr://fa9652ac3c6dff228fc01c35e868c2cc2da2f014467b7018299427c045c49c0d
{ "func_code_index": [ 769, 1310 ] }
5,733
Anastomos
Anastomos.sol
0xefacc9531c7749a637cd82fab6ac4b9f991c04b8
Solidity
Anastomos
contract Anastomos { /* Public variables of the token */ string public standard = 'Anastomos 0.1'; string public name; string public symbol; uint8 public decimals; 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); /* Initializes contract with initial supply tokens to the creator of the contract */ function Anastomos() { balanceOf[msg.sender] = 500000000 * 1000000000000000000; // Give the creator all initial tokens totalSupply = 500000000 * 1000000000000000000; // Update total supply name = "Anastomos"; // Set the name for display purposes symbol = "AT"; // Set the symbol for display purposes decimals = 18; // Amount of decimals for display purposes } /* Send coins */ function transfer(address _to, uint256 _value) { if (_to == 0x0) revert(); // Prevent transfer to 0x0 address. Use burn() instead if (balanceOf[msg.sender] < _value) revert(); // Check if the sender has enough if (balanceOf[_to] + _value < balanceOf[_to]) revert(); // Check for overflows balanceOf[msg.sender] -= _value; // Subtract from the sender balanceOf[_to] += _value; // Add the same to the recipient Transfer(msg.sender, _to, _value); // Notify anyone listening that this transfer took place } /* Allow another contract to spend some tokens in your behalf */ function approve(address _spender, uint256 _value) returns (bool success) { allowance[msg.sender][_spender] = _value; return true; } /* Approve and then communicate the approved contract in a single tx */ function approveAndCall(address _spender, uint256 _value, bytes _extraData) returns (bool success) { tokenRecipient spender = tokenRecipient(_spender); if (approve(_spender, _value)) { spender.receiveApproval(msg.sender, _value, this, _extraData); return true; } } /* A contract attempts to get the coins */ function transferFrom(address _from, address _to, uint256 _value) returns (bool success) { if (_to == 0x0) revert(); // Prevent transfer to 0x0 address. Use burn() instead if (balanceOf[_from] < _value) revert(); // Check if the sender has enough if (balanceOf[_to] + _value < balanceOf[_to]) revert(); // Check for overflows if (_value > allowance[_from][msg.sender]) revert(); // Check allowance balanceOf[_from] -= _value; // Subtract from the sender balanceOf[_to] += _value; // Add the same to the recipient allowance[_from][msg.sender] -= _value; Transfer(_from, _to, _value); return true; } function burn(uint256 _value) returns (bool success) { if (balanceOf[msg.sender] < _value) revert(); // Check if the sender has enough balanceOf[msg.sender] -= _value; // Subtract from the sender totalSupply -= _value; // Updates totalSupply Burn(msg.sender, _value); return true; } function burnFrom(address _from, uint256 _value) returns (bool success) { if (balanceOf[_from] < _value) revert(); // Check if the sender has enough if (_value > allowance[_from][msg.sender]) revert(); // Check allowance balanceOf[_from] -= _value; // Subtract from the sender totalSupply -= _value; // Updates totalSupply Burn(_from, _value); return true; } }
transfer
function transfer(address _to, uint256 _value) { if (_to == 0x0) revert(); // Prevent transfer to 0x0 address. Use burn() instead if (balanceOf[msg.sender] < _value) revert(); // Check if the sender has enough if (balanceOf[_to] + _value < balanceOf[_to]) revert(); // Check for overflows balanceOf[msg.sender] -= _value; // Subtract from the sender balanceOf[_to] += _value; // Add the same to the recipient Transfer(msg.sender, _to, _value); // Notify anyone listening that this transfer took place }
/* Send coins */
Comment
v0.4.13+commit.fb4cb1a
bzzr://fa9652ac3c6dff228fc01c35e868c2cc2da2f014467b7018299427c045c49c0d
{ "func_code_index": [ 1335, 2006 ] }
5,734
Anastomos
Anastomos.sol
0xefacc9531c7749a637cd82fab6ac4b9f991c04b8
Solidity
Anastomos
contract Anastomos { /* Public variables of the token */ string public standard = 'Anastomos 0.1'; string public name; string public symbol; uint8 public decimals; 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); /* Initializes contract with initial supply tokens to the creator of the contract */ function Anastomos() { balanceOf[msg.sender] = 500000000 * 1000000000000000000; // Give the creator all initial tokens totalSupply = 500000000 * 1000000000000000000; // Update total supply name = "Anastomos"; // Set the name for display purposes symbol = "AT"; // Set the symbol for display purposes decimals = 18; // Amount of decimals for display purposes } /* Send coins */ function transfer(address _to, uint256 _value) { if (_to == 0x0) revert(); // Prevent transfer to 0x0 address. Use burn() instead if (balanceOf[msg.sender] < _value) revert(); // Check if the sender has enough if (balanceOf[_to] + _value < balanceOf[_to]) revert(); // Check for overflows balanceOf[msg.sender] -= _value; // Subtract from the sender balanceOf[_to] += _value; // Add the same to the recipient Transfer(msg.sender, _to, _value); // Notify anyone listening that this transfer took place } /* Allow another contract to spend some tokens in your behalf */ function approve(address _spender, uint256 _value) returns (bool success) { allowance[msg.sender][_spender] = _value; return true; } /* Approve and then communicate the approved contract in a single tx */ function approveAndCall(address _spender, uint256 _value, bytes _extraData) returns (bool success) { tokenRecipient spender = tokenRecipient(_spender); if (approve(_spender, _value)) { spender.receiveApproval(msg.sender, _value, this, _extraData); return true; } } /* A contract attempts to get the coins */ function transferFrom(address _from, address _to, uint256 _value) returns (bool success) { if (_to == 0x0) revert(); // Prevent transfer to 0x0 address. Use burn() instead if (balanceOf[_from] < _value) revert(); // Check if the sender has enough if (balanceOf[_to] + _value < balanceOf[_to]) revert(); // Check for overflows if (_value > allowance[_from][msg.sender]) revert(); // Check allowance balanceOf[_from] -= _value; // Subtract from the sender balanceOf[_to] += _value; // Add the same to the recipient allowance[_from][msg.sender] -= _value; Transfer(_from, _to, _value); return true; } function burn(uint256 _value) returns (bool success) { if (balanceOf[msg.sender] < _value) revert(); // Check if the sender has enough balanceOf[msg.sender] -= _value; // Subtract from the sender totalSupply -= _value; // Updates totalSupply Burn(msg.sender, _value); return true; } function burnFrom(address _from, uint256 _value) returns (bool success) { if (balanceOf[_from] < _value) revert(); // Check if the sender has enough if (_value > allowance[_from][msg.sender]) revert(); // Check allowance balanceOf[_from] -= _value; // Subtract from the sender totalSupply -= _value; // Updates totalSupply Burn(_from, _value); return true; } }
approve
function approve(address _spender, uint256 _value) returns (bool success) { allowance[msg.sender][_spender] = _value; return true; }
/* Allow another contract to spend some tokens in your behalf */
Comment
v0.4.13+commit.fb4cb1a
bzzr://fa9652ac3c6dff228fc01c35e868c2cc2da2f014467b7018299427c045c49c0d
{ "func_code_index": [ 2079, 2248 ] }
5,735
Anastomos
Anastomos.sol
0xefacc9531c7749a637cd82fab6ac4b9f991c04b8
Solidity
Anastomos
contract Anastomos { /* Public variables of the token */ string public standard = 'Anastomos 0.1'; string public name; string public symbol; uint8 public decimals; 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); /* Initializes contract with initial supply tokens to the creator of the contract */ function Anastomos() { balanceOf[msg.sender] = 500000000 * 1000000000000000000; // Give the creator all initial tokens totalSupply = 500000000 * 1000000000000000000; // Update total supply name = "Anastomos"; // Set the name for display purposes symbol = "AT"; // Set the symbol for display purposes decimals = 18; // Amount of decimals for display purposes } /* Send coins */ function transfer(address _to, uint256 _value) { if (_to == 0x0) revert(); // Prevent transfer to 0x0 address. Use burn() instead if (balanceOf[msg.sender] < _value) revert(); // Check if the sender has enough if (balanceOf[_to] + _value < balanceOf[_to]) revert(); // Check for overflows balanceOf[msg.sender] -= _value; // Subtract from the sender balanceOf[_to] += _value; // Add the same to the recipient Transfer(msg.sender, _to, _value); // Notify anyone listening that this transfer took place } /* Allow another contract to spend some tokens in your behalf */ function approve(address _spender, uint256 _value) returns (bool success) { allowance[msg.sender][_spender] = _value; return true; } /* Approve and then communicate the approved contract in a single tx */ function approveAndCall(address _spender, uint256 _value, bytes _extraData) returns (bool success) { tokenRecipient spender = tokenRecipient(_spender); if (approve(_spender, _value)) { spender.receiveApproval(msg.sender, _value, this, _extraData); return true; } } /* A contract attempts to get the coins */ function transferFrom(address _from, address _to, uint256 _value) returns (bool success) { if (_to == 0x0) revert(); // Prevent transfer to 0x0 address. Use burn() instead if (balanceOf[_from] < _value) revert(); // Check if the sender has enough if (balanceOf[_to] + _value < balanceOf[_to]) revert(); // Check for overflows if (_value > allowance[_from][msg.sender]) revert(); // Check allowance balanceOf[_from] -= _value; // Subtract from the sender balanceOf[_to] += _value; // Add the same to the recipient allowance[_from][msg.sender] -= _value; Transfer(_from, _to, _value); return true; } function burn(uint256 _value) returns (bool success) { if (balanceOf[msg.sender] < _value) revert(); // Check if the sender has enough balanceOf[msg.sender] -= _value; // Subtract from the sender totalSupply -= _value; // Updates totalSupply Burn(msg.sender, _value); return true; } function burnFrom(address _from, uint256 _value) returns (bool success) { if (balanceOf[_from] < _value) revert(); // Check if the sender has enough if (_value > allowance[_from][msg.sender]) revert(); // Check allowance balanceOf[_from] -= _value; // Subtract from the sender totalSupply -= _value; // Updates totalSupply Burn(_from, _value); return true; } }
approveAndCall
function approveAndCall(address _spender, uint256 _value, bytes _extraData) returns (bool success) { tokenRecipient spender = tokenRecipient(_spender); if (approve(_spender, _value)) { spender.receiveApproval(msg.sender, _value, this, _extraData); return true; } }
/* Approve and then communicate the approved contract in a single tx */
Comment
v0.4.13+commit.fb4cb1a
bzzr://fa9652ac3c6dff228fc01c35e868c2cc2da2f014467b7018299427c045c49c0d
{ "func_code_index": [ 2328, 2672 ] }
5,736
Anastomos
Anastomos.sol
0xefacc9531c7749a637cd82fab6ac4b9f991c04b8
Solidity
Anastomos
contract Anastomos { /* Public variables of the token */ string public standard = 'Anastomos 0.1'; string public name; string public symbol; uint8 public decimals; 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); /* Initializes contract with initial supply tokens to the creator of the contract */ function Anastomos() { balanceOf[msg.sender] = 500000000 * 1000000000000000000; // Give the creator all initial tokens totalSupply = 500000000 * 1000000000000000000; // Update total supply name = "Anastomos"; // Set the name for display purposes symbol = "AT"; // Set the symbol for display purposes decimals = 18; // Amount of decimals for display purposes } /* Send coins */ function transfer(address _to, uint256 _value) { if (_to == 0x0) revert(); // Prevent transfer to 0x0 address. Use burn() instead if (balanceOf[msg.sender] < _value) revert(); // Check if the sender has enough if (balanceOf[_to] + _value < balanceOf[_to]) revert(); // Check for overflows balanceOf[msg.sender] -= _value; // Subtract from the sender balanceOf[_to] += _value; // Add the same to the recipient Transfer(msg.sender, _to, _value); // Notify anyone listening that this transfer took place } /* Allow another contract to spend some tokens in your behalf */ function approve(address _spender, uint256 _value) returns (bool success) { allowance[msg.sender][_spender] = _value; return true; } /* Approve and then communicate the approved contract in a single tx */ function approveAndCall(address _spender, uint256 _value, bytes _extraData) returns (bool success) { tokenRecipient spender = tokenRecipient(_spender); if (approve(_spender, _value)) { spender.receiveApproval(msg.sender, _value, this, _extraData); return true; } } /* A contract attempts to get the coins */ function transferFrom(address _from, address _to, uint256 _value) returns (bool success) { if (_to == 0x0) revert(); // Prevent transfer to 0x0 address. Use burn() instead if (balanceOf[_from] < _value) revert(); // Check if the sender has enough if (balanceOf[_to] + _value < balanceOf[_to]) revert(); // Check for overflows if (_value > allowance[_from][msg.sender]) revert(); // Check allowance balanceOf[_from] -= _value; // Subtract from the sender balanceOf[_to] += _value; // Add the same to the recipient allowance[_from][msg.sender] -= _value; Transfer(_from, _to, _value); return true; } function burn(uint256 _value) returns (bool success) { if (balanceOf[msg.sender] < _value) revert(); // Check if the sender has enough balanceOf[msg.sender] -= _value; // Subtract from the sender totalSupply -= _value; // Updates totalSupply Burn(msg.sender, _value); return true; } function burnFrom(address _from, uint256 _value) returns (bool success) { if (balanceOf[_from] < _value) revert(); // Check if the sender has enough if (_value > allowance[_from][msg.sender]) revert(); // Check allowance balanceOf[_from] -= _value; // Subtract from the sender totalSupply -= _value; // Updates totalSupply Burn(_from, _value); return true; } }
transferFrom
function transferFrom(address _from, address _to, uint256 _value) returns (bool success) { if (_to == 0x0) revert(); // Prevent transfer to 0x0 address. Use burn() instead if (balanceOf[_from] < _value) revert(); // Check if the sender has enough if (balanceOf[_to] + _value < balanceOf[_to]) revert(); // Check for overflows if (_value > allowance[_from][msg.sender]) revert(); // Check allowance balanceOf[_from] -= _value; // Subtract from the sender balanceOf[_to] += _value; // Add the same to the recipient allowance[_from][msg.sender] -= _value; Transfer(_from, _to, _value); return true; }
/* A contract attempts to get the coins */
Comment
v0.4.13+commit.fb4cb1a
bzzr://fa9652ac3c6dff228fc01c35e868c2cc2da2f014467b7018299427c045c49c0d
{ "func_code_index": [ 2723, 3517 ] }
5,737
DSToken
solidity/contracts/token/DSToken.sol
0xa78a391a060b3b904eba36e4f28b97d86ce0548a
Solidity
DSToken
contract DSToken is IDSToken, ERC20Token, Owned { using SafeMath for uint256; /** * @dev triggered when the total supply is increased * * @param _amount amount that gets added to the supply */ event Issuance(uint256 _amount); /** * @dev triggered when the total supply is decreased * * @param _amount amount that gets removed from the supply */ event Destruction(uint256 _amount); /** * @dev initializes a new DSToken instance * * @param _name token name * @param _symbol token short symbol, minimum 1 character * @param _decimals for display purposes only */ constructor(string memory _name, string memory _symbol, uint8 _decimals) public ERC20Token(_name, _symbol, _decimals, 0) { } /** * @dev increases the token supply and sends the new tokens to the given account * can only be called by the contract owner * * @param _to account to receive the new amount * @param _amount amount to increase the supply by */ function issue(address _to, uint256 _amount) public override ownerOnly validAddress(_to) notThis(_to) { totalSupply = totalSupply.add(_amount); balanceOf[_to] = balanceOf[_to].add(_amount); emit Issuance(_amount); emit Transfer(address(0), _to, _amount); } /** * @dev removes tokens from the given account and decreases the token supply * can only be called by the contract owner * * @param _from account to remove the amount from * @param _amount amount to decrease the supply by */ function destroy(address _from, uint256 _amount) public override ownerOnly { balanceOf[_from] = balanceOf[_from].sub(_amount); totalSupply = totalSupply.sub(_amount); emit Transfer(_from, address(0), _amount); emit Destruction(_amount); } // ERC20 standard method overrides with some extra functionality /** * @dev send coins * throws on any error rather then return a false flag to minimize user errors * in addition to the standard checks, the function throws if transfers are disabled * * @param _to target address * @param _value transfer amount * * @return true if the transfer was successful, false if it wasn't */ function transfer(address _to, uint256 _value) public override(IERC20Token, ERC20Token) returns (bool) { return super.transfer(_to, _value); } /** * @dev an account/contract attempts to get the coins * throws on any error rather then return a false flag to minimize user errors * in addition to the standard checks, the function throws if transfers are disabled * * @param _from source address * @param _to target address * @param _value transfer amount * * @return true if the transfer was successful, false if it wasn't */ function transferFrom(address _from, address _to, uint256 _value) public override(IERC20Token, ERC20Token) returns (bool) { return super.transferFrom(_from, _to, _value); } }
/** * @dev DSToken represents a token with dynamic supply. * The owner of the token can mint/burn tokens to/from any account. * */
NatSpecMultiLine
issue
function issue(address _to, uint256 _amount) public override ownerOnly validAddress(_to) notThis(_to) { totalSupply = totalSupply.add(_amount); balanceOf[_to] = balanceOf[_to].add(_amount); emit Issuance(_amount); emit Transfer(address(0), _to, _amount); }
/** * @dev increases the token supply and sends the new tokens to the given account * can only be called by the contract owner * * @param _to account to receive the new amount * @param _amount amount to increase the supply by */
NatSpecMultiLine
v0.6.12+commit.27d51765
None
ipfs://3442b0030f95c9b0d8d1afedc1ca252936bd53ca32379f17ce8ae61e96df9ee6
{ "func_code_index": [ 1143, 1497 ] }
5,738
DSToken
solidity/contracts/token/DSToken.sol
0xa78a391a060b3b904eba36e4f28b97d86ce0548a
Solidity
DSToken
contract DSToken is IDSToken, ERC20Token, Owned { using SafeMath for uint256; /** * @dev triggered when the total supply is increased * * @param _amount amount that gets added to the supply */ event Issuance(uint256 _amount); /** * @dev triggered when the total supply is decreased * * @param _amount amount that gets removed from the supply */ event Destruction(uint256 _amount); /** * @dev initializes a new DSToken instance * * @param _name token name * @param _symbol token short symbol, minimum 1 character * @param _decimals for display purposes only */ constructor(string memory _name, string memory _symbol, uint8 _decimals) public ERC20Token(_name, _symbol, _decimals, 0) { } /** * @dev increases the token supply and sends the new tokens to the given account * can only be called by the contract owner * * @param _to account to receive the new amount * @param _amount amount to increase the supply by */ function issue(address _to, uint256 _amount) public override ownerOnly validAddress(_to) notThis(_to) { totalSupply = totalSupply.add(_amount); balanceOf[_to] = balanceOf[_to].add(_amount); emit Issuance(_amount); emit Transfer(address(0), _to, _amount); } /** * @dev removes tokens from the given account and decreases the token supply * can only be called by the contract owner * * @param _from account to remove the amount from * @param _amount amount to decrease the supply by */ function destroy(address _from, uint256 _amount) public override ownerOnly { balanceOf[_from] = balanceOf[_from].sub(_amount); totalSupply = totalSupply.sub(_amount); emit Transfer(_from, address(0), _amount); emit Destruction(_amount); } // ERC20 standard method overrides with some extra functionality /** * @dev send coins * throws on any error rather then return a false flag to minimize user errors * in addition to the standard checks, the function throws if transfers are disabled * * @param _to target address * @param _value transfer amount * * @return true if the transfer was successful, false if it wasn't */ function transfer(address _to, uint256 _value) public override(IERC20Token, ERC20Token) returns (bool) { return super.transfer(_to, _value); } /** * @dev an account/contract attempts to get the coins * throws on any error rather then return a false flag to minimize user errors * in addition to the standard checks, the function throws if transfers are disabled * * @param _from source address * @param _to target address * @param _value transfer amount * * @return true if the transfer was successful, false if it wasn't */ function transferFrom(address _from, address _to, uint256 _value) public override(IERC20Token, ERC20Token) returns (bool) { return super.transferFrom(_from, _to, _value); } }
/** * @dev DSToken represents a token with dynamic supply. * The owner of the token can mint/burn tokens to/from any account. * */
NatSpecMultiLine
destroy
function destroy(address _from, uint256 _amount) public override ownerOnly { balanceOf[_from] = balanceOf[_from].sub(_amount); totalSupply = totalSupply.sub(_amount); emit Transfer(_from, address(0), _amount); emit Destruction(_amount); }
/** * @dev removes tokens from the given account and decreases the token supply * can only be called by the contract owner * * @param _from account to remove the amount from * @param _amount amount to decrease the supply by */
NatSpecMultiLine
v0.6.12+commit.27d51765
None
ipfs://3442b0030f95c9b0d8d1afedc1ca252936bd53ca32379f17ce8ae61e96df9ee6
{ "func_code_index": [ 1776, 2062 ] }
5,739
DSToken
solidity/contracts/token/DSToken.sol
0xa78a391a060b3b904eba36e4f28b97d86ce0548a
Solidity
DSToken
contract DSToken is IDSToken, ERC20Token, Owned { using SafeMath for uint256; /** * @dev triggered when the total supply is increased * * @param _amount amount that gets added to the supply */ event Issuance(uint256 _amount); /** * @dev triggered when the total supply is decreased * * @param _amount amount that gets removed from the supply */ event Destruction(uint256 _amount); /** * @dev initializes a new DSToken instance * * @param _name token name * @param _symbol token short symbol, minimum 1 character * @param _decimals for display purposes only */ constructor(string memory _name, string memory _symbol, uint8 _decimals) public ERC20Token(_name, _symbol, _decimals, 0) { } /** * @dev increases the token supply and sends the new tokens to the given account * can only be called by the contract owner * * @param _to account to receive the new amount * @param _amount amount to increase the supply by */ function issue(address _to, uint256 _amount) public override ownerOnly validAddress(_to) notThis(_to) { totalSupply = totalSupply.add(_amount); balanceOf[_to] = balanceOf[_to].add(_amount); emit Issuance(_amount); emit Transfer(address(0), _to, _amount); } /** * @dev removes tokens from the given account and decreases the token supply * can only be called by the contract owner * * @param _from account to remove the amount from * @param _amount amount to decrease the supply by */ function destroy(address _from, uint256 _amount) public override ownerOnly { balanceOf[_from] = balanceOf[_from].sub(_amount); totalSupply = totalSupply.sub(_amount); emit Transfer(_from, address(0), _amount); emit Destruction(_amount); } // ERC20 standard method overrides with some extra functionality /** * @dev send coins * throws on any error rather then return a false flag to minimize user errors * in addition to the standard checks, the function throws if transfers are disabled * * @param _to target address * @param _value transfer amount * * @return true if the transfer was successful, false if it wasn't */ function transfer(address _to, uint256 _value) public override(IERC20Token, ERC20Token) returns (bool) { return super.transfer(_to, _value); } /** * @dev an account/contract attempts to get the coins * throws on any error rather then return a false flag to minimize user errors * in addition to the standard checks, the function throws if transfers are disabled * * @param _from source address * @param _to target address * @param _value transfer amount * * @return true if the transfer was successful, false if it wasn't */ function transferFrom(address _from, address _to, uint256 _value) public override(IERC20Token, ERC20Token) returns (bool) { return super.transferFrom(_from, _to, _value); } }
/** * @dev DSToken represents a token with dynamic supply. * The owner of the token can mint/burn tokens to/from any account. * */
NatSpecMultiLine
transfer
function transfer(address _to, uint256 _value) public override(IERC20Token, ERC20Token) returns (bool) { return super.transfer(_to, _value); }
/** * @dev send coins * throws on any error rather then return a false flag to minimize user errors * in addition to the standard checks, the function throws if transfers are disabled * * @param _to target address * @param _value transfer amount * * @return true if the transfer was successful, false if it wasn't */
NatSpecMultiLine
v0.6.12+commit.27d51765
None
ipfs://3442b0030f95c9b0d8d1afedc1ca252936bd53ca32379f17ce8ae61e96df9ee6
{ "func_code_index": [ 2527, 2720 ] }
5,740
DSToken
solidity/contracts/token/DSToken.sol
0xa78a391a060b3b904eba36e4f28b97d86ce0548a
Solidity
DSToken
contract DSToken is IDSToken, ERC20Token, Owned { using SafeMath for uint256; /** * @dev triggered when the total supply is increased * * @param _amount amount that gets added to the supply */ event Issuance(uint256 _amount); /** * @dev triggered when the total supply is decreased * * @param _amount amount that gets removed from the supply */ event Destruction(uint256 _amount); /** * @dev initializes a new DSToken instance * * @param _name token name * @param _symbol token short symbol, minimum 1 character * @param _decimals for display purposes only */ constructor(string memory _name, string memory _symbol, uint8 _decimals) public ERC20Token(_name, _symbol, _decimals, 0) { } /** * @dev increases the token supply and sends the new tokens to the given account * can only be called by the contract owner * * @param _to account to receive the new amount * @param _amount amount to increase the supply by */ function issue(address _to, uint256 _amount) public override ownerOnly validAddress(_to) notThis(_to) { totalSupply = totalSupply.add(_amount); balanceOf[_to] = balanceOf[_to].add(_amount); emit Issuance(_amount); emit Transfer(address(0), _to, _amount); } /** * @dev removes tokens from the given account and decreases the token supply * can only be called by the contract owner * * @param _from account to remove the amount from * @param _amount amount to decrease the supply by */ function destroy(address _from, uint256 _amount) public override ownerOnly { balanceOf[_from] = balanceOf[_from].sub(_amount); totalSupply = totalSupply.sub(_amount); emit Transfer(_from, address(0), _amount); emit Destruction(_amount); } // ERC20 standard method overrides with some extra functionality /** * @dev send coins * throws on any error rather then return a false flag to minimize user errors * in addition to the standard checks, the function throws if transfers are disabled * * @param _to target address * @param _value transfer amount * * @return true if the transfer was successful, false if it wasn't */ function transfer(address _to, uint256 _value) public override(IERC20Token, ERC20Token) returns (bool) { return super.transfer(_to, _value); } /** * @dev an account/contract attempts to get the coins * throws on any error rather then return a false flag to minimize user errors * in addition to the standard checks, the function throws if transfers are disabled * * @param _from source address * @param _to target address * @param _value transfer amount * * @return true if the transfer was successful, false if it wasn't */ function transferFrom(address _from, address _to, uint256 _value) public override(IERC20Token, ERC20Token) returns (bool) { return super.transferFrom(_from, _to, _value); } }
/** * @dev DSToken represents a token with dynamic supply. * The owner of the token can mint/burn tokens to/from any account. * */
NatSpecMultiLine
transferFrom
function transferFrom(address _from, address _to, uint256 _value) public override(IERC20Token, ERC20Token) returns (bool) { return super.transferFrom(_from, _to, _value); }
/** * @dev an account/contract attempts to get the coins * throws on any error rather then return a false flag to minimize user errors * in addition to the standard checks, the function throws if transfers are disabled * * @param _from source address * @param _to target address * @param _value transfer amount * * @return true if the transfer was successful, false if it wasn't */
NatSpecMultiLine
v0.6.12+commit.27d51765
None
ipfs://3442b0030f95c9b0d8d1afedc1ca252936bd53ca32379f17ce8ae61e96df9ee6
{ "func_code_index": [ 3188, 3412 ] }
5,741
DSToken
solidity/contracts/token/ERC20Token.sol
0xa78a391a060b3b904eba36e4f28b97d86ce0548a
Solidity
ERC20Token
contract ERC20Token is IERC20Token, Utils { using SafeMath for uint256; string public override name; string public override symbol; uint8 public override decimals; uint256 public override totalSupply; mapping (address => uint256) public override balanceOf; mapping (address => mapping (address => uint256)) public override allowance; /** * @dev triggered when tokens are transferred between wallets * * @param _from source address * @param _to target address * @param _value transfer amount */ event Transfer(address indexed _from, address indexed _to, uint256 _value); /** * @dev triggered when a wallet allows another wallet to transfer tokens from on its behalf * * @param _owner wallet that approves the allowance * @param _spender wallet that receives the allowance * @param _value allowance amount */ event Approval(address indexed _owner, address indexed _spender, uint256 _value); /** * @dev initializes a new ERC20Token instance * * @param _name token name * @param _symbol token symbol * @param _decimals decimal points, for display purposes * @param _totalSupply total supply of token units */ constructor(string memory _name, string memory _symbol, uint8 _decimals, uint256 _totalSupply) public { // validate input require(bytes(_name).length > 0, "ERR_INVALID_NAME"); require(bytes(_symbol).length > 0, "ERR_INVALID_SYMBOL"); name = _name; symbol = _symbol; decimals = _decimals; totalSupply = _totalSupply; balanceOf[msg.sender] = _totalSupply; } /** * @dev transfers tokens to a given address * throws on any error rather then return a false flag to minimize user errors * * @param _to target address * @param _value transfer amount * * @return true if the transfer was successful, false if it wasn't */ function transfer(address _to, uint256 _value) public virtual override validAddress(_to) returns (bool) { balanceOf[msg.sender] = balanceOf[msg.sender].sub(_value); balanceOf[_to] = balanceOf[_to].add(_value); emit Transfer(msg.sender, _to, _value); return true; } /** * @dev transfers tokens to a given address on behalf of another address * throws on any error rather then return a false flag to minimize user errors * * @param _from source address * @param _to target address * @param _value transfer amount * * @return true if the transfer was successful, false if it wasn't */ function transferFrom(address _from, address _to, uint256 _value) public virtual override validAddress(_from) validAddress(_to) returns (bool) { allowance[_from][msg.sender] = allowance[_from][msg.sender].sub(_value); balanceOf[_from] = balanceOf[_from].sub(_value); balanceOf[_to] = balanceOf[_to].add(_value); emit Transfer(_from, _to, _value); return true; } /** * @dev allows another account/contract to transfers tokens on behalf of the caller * throws on any error rather then return a false flag to minimize user errors * * @param _spender approved address * @param _value allowance amount * * @return true if the approval was successful, false if it wasn't */ function approve(address _spender, uint256 _value) public virtual override validAddress(_spender) returns (bool) { allowance[msg.sender][_spender] = _value; emit Approval(msg.sender, _spender, _value); return true; } }
/** * @dev ERC20 Standard Token implementation */
NatSpecMultiLine
transfer
function transfer(address _to, uint256 _value) public virtual override validAddress(_to) returns (bool) { balanceOf[msg.sender] = balanceOf[msg.sender].sub(_value); balanceOf[_to] = balanceOf[_to].add(_value); emit Transfer(msg.sender, _to, _value); return true; }
/** * @dev transfers tokens to a given address * throws on any error rather then return a false flag to minimize user errors * * @param _to target address * @param _value transfer amount * * @return true if the transfer was successful, false if it wasn't */
NatSpecMultiLine
v0.6.12+commit.27d51765
None
ipfs://3442b0030f95c9b0d8d1afedc1ca252936bd53ca32379f17ce8ae61e96df9ee6
{ "func_code_index": [ 2098, 2458 ] }
5,742
DSToken
solidity/contracts/token/ERC20Token.sol
0xa78a391a060b3b904eba36e4f28b97d86ce0548a
Solidity
ERC20Token
contract ERC20Token is IERC20Token, Utils { using SafeMath for uint256; string public override name; string public override symbol; uint8 public override decimals; uint256 public override totalSupply; mapping (address => uint256) public override balanceOf; mapping (address => mapping (address => uint256)) public override allowance; /** * @dev triggered when tokens are transferred between wallets * * @param _from source address * @param _to target address * @param _value transfer amount */ event Transfer(address indexed _from, address indexed _to, uint256 _value); /** * @dev triggered when a wallet allows another wallet to transfer tokens from on its behalf * * @param _owner wallet that approves the allowance * @param _spender wallet that receives the allowance * @param _value allowance amount */ event Approval(address indexed _owner, address indexed _spender, uint256 _value); /** * @dev initializes a new ERC20Token instance * * @param _name token name * @param _symbol token symbol * @param _decimals decimal points, for display purposes * @param _totalSupply total supply of token units */ constructor(string memory _name, string memory _symbol, uint8 _decimals, uint256 _totalSupply) public { // validate input require(bytes(_name).length > 0, "ERR_INVALID_NAME"); require(bytes(_symbol).length > 0, "ERR_INVALID_SYMBOL"); name = _name; symbol = _symbol; decimals = _decimals; totalSupply = _totalSupply; balanceOf[msg.sender] = _totalSupply; } /** * @dev transfers tokens to a given address * throws on any error rather then return a false flag to minimize user errors * * @param _to target address * @param _value transfer amount * * @return true if the transfer was successful, false if it wasn't */ function transfer(address _to, uint256 _value) public virtual override validAddress(_to) returns (bool) { balanceOf[msg.sender] = balanceOf[msg.sender].sub(_value); balanceOf[_to] = balanceOf[_to].add(_value); emit Transfer(msg.sender, _to, _value); return true; } /** * @dev transfers tokens to a given address on behalf of another address * throws on any error rather then return a false flag to minimize user errors * * @param _from source address * @param _to target address * @param _value transfer amount * * @return true if the transfer was successful, false if it wasn't */ function transferFrom(address _from, address _to, uint256 _value) public virtual override validAddress(_from) validAddress(_to) returns (bool) { allowance[_from][msg.sender] = allowance[_from][msg.sender].sub(_value); balanceOf[_from] = balanceOf[_from].sub(_value); balanceOf[_to] = balanceOf[_to].add(_value); emit Transfer(_from, _to, _value); return true; } /** * @dev allows another account/contract to transfers tokens on behalf of the caller * throws on any error rather then return a false flag to minimize user errors * * @param _spender approved address * @param _value allowance amount * * @return true if the approval was successful, false if it wasn't */ function approve(address _spender, uint256 _value) public virtual override validAddress(_spender) returns (bool) { allowance[msg.sender][_spender] = _value; emit Approval(msg.sender, _spender, _value); return true; } }
/** * @dev ERC20 Standard Token implementation */
NatSpecMultiLine
transferFrom
function transferFrom(address _from, address _to, uint256 _value) public virtual override validAddress(_from) validAddress(_to) returns (bool) { allowance[_from][msg.sender] = allowance[_from][msg.sender].sub(_value); balanceOf[_from] = balanceOf[_from].sub(_value); balanceOf[_to] = balanceOf[_to].add(_value); emit Transfer(_from, _to, _value); return true; }
/** * @dev transfers tokens to a given address on behalf of another address * throws on any error rather then return a false flag to minimize user errors * * @param _from source address * @param _to target address * @param _value transfer amount * * @return true if the transfer was successful, false if it wasn't */
NatSpecMultiLine
v0.6.12+commit.27d51765
None
ipfs://3442b0030f95c9b0d8d1afedc1ca252936bd53ca32379f17ce8ae61e96df9ee6
{ "func_code_index": [ 2854, 3329 ] }
5,743
DSToken
solidity/contracts/token/ERC20Token.sol
0xa78a391a060b3b904eba36e4f28b97d86ce0548a
Solidity
ERC20Token
contract ERC20Token is IERC20Token, Utils { using SafeMath for uint256; string public override name; string public override symbol; uint8 public override decimals; uint256 public override totalSupply; mapping (address => uint256) public override balanceOf; mapping (address => mapping (address => uint256)) public override allowance; /** * @dev triggered when tokens are transferred between wallets * * @param _from source address * @param _to target address * @param _value transfer amount */ event Transfer(address indexed _from, address indexed _to, uint256 _value); /** * @dev triggered when a wallet allows another wallet to transfer tokens from on its behalf * * @param _owner wallet that approves the allowance * @param _spender wallet that receives the allowance * @param _value allowance amount */ event Approval(address indexed _owner, address indexed _spender, uint256 _value); /** * @dev initializes a new ERC20Token instance * * @param _name token name * @param _symbol token symbol * @param _decimals decimal points, for display purposes * @param _totalSupply total supply of token units */ constructor(string memory _name, string memory _symbol, uint8 _decimals, uint256 _totalSupply) public { // validate input require(bytes(_name).length > 0, "ERR_INVALID_NAME"); require(bytes(_symbol).length > 0, "ERR_INVALID_SYMBOL"); name = _name; symbol = _symbol; decimals = _decimals; totalSupply = _totalSupply; balanceOf[msg.sender] = _totalSupply; } /** * @dev transfers tokens to a given address * throws on any error rather then return a false flag to minimize user errors * * @param _to target address * @param _value transfer amount * * @return true if the transfer was successful, false if it wasn't */ function transfer(address _to, uint256 _value) public virtual override validAddress(_to) returns (bool) { balanceOf[msg.sender] = balanceOf[msg.sender].sub(_value); balanceOf[_to] = balanceOf[_to].add(_value); emit Transfer(msg.sender, _to, _value); return true; } /** * @dev transfers tokens to a given address on behalf of another address * throws on any error rather then return a false flag to minimize user errors * * @param _from source address * @param _to target address * @param _value transfer amount * * @return true if the transfer was successful, false if it wasn't */ function transferFrom(address _from, address _to, uint256 _value) public virtual override validAddress(_from) validAddress(_to) returns (bool) { allowance[_from][msg.sender] = allowance[_from][msg.sender].sub(_value); balanceOf[_from] = balanceOf[_from].sub(_value); balanceOf[_to] = balanceOf[_to].add(_value); emit Transfer(_from, _to, _value); return true; } /** * @dev allows another account/contract to transfers tokens on behalf of the caller * throws on any error rather then return a false flag to minimize user errors * * @param _spender approved address * @param _value allowance amount * * @return true if the approval was successful, false if it wasn't */ function approve(address _spender, uint256 _value) public virtual override validAddress(_spender) returns (bool) { allowance[msg.sender][_spender] = _value; emit Approval(msg.sender, _spender, _value); return true; } }
/** * @dev ERC20 Standard Token implementation */
NatSpecMultiLine
approve
function approve(address _spender, uint256 _value) public virtual override validAddress(_spender) returns (bool) { allowance[msg.sender][_spender] = _value; emit Approval(msg.sender, _spender, _value); return true; }
/** * @dev allows another account/contract to transfers tokens on behalf of the caller * throws on any error rather then return a false flag to minimize user errors * * @param _spender approved address * @param _value allowance amount * * @return true if the approval was successful, false if it wasn't */
NatSpecMultiLine
v0.6.12+commit.27d51765
None
ipfs://3442b0030f95c9b0d8d1afedc1ca252936bd53ca32379f17ce8ae61e96df9ee6
{ "func_code_index": [ 3699, 4002 ] }
5,744
Erc20VaultPoolSwap
@powerpool/poweroracle/contracts/interfaces/IPowerPoke.sol
0x13832ea959ff5f4de001f7d4bbbd4b16f140bb76
Solidity
IPowerPoke
interface IPowerPoke { /*** CLIENT'S CONTRACT INTERFACE ***/ function authorizeReporter(uint256 userId_, address pokerKey_) external view; function authorizeNonReporter(uint256 userId_, address pokerKey_) external view; function authorizeNonReporterWithDeposit( uint256 userId_, address pokerKey_, uint256 overrideMinDeposit_ ) external view; function authorizePoker(uint256 userId_, address pokerKey_) external view; function authorizePokerWithDeposit( uint256 userId_, address pokerKey_, uint256 overrideMinStake_ ) external view; function slashReporter(uint256 slasherId_, uint256 times_) external; function reward( uint256 userId_, uint256 gasUsed_, uint256 compensationPlan_, bytes calldata pokeOptions_ ) external; /*** CLIENT OWNER INTERFACE ***/ function transferClientOwnership(address client_, address to_) external; function addCredit(address client_, uint256 amount_) external; function withdrawCredit( address client_, address to_, uint256 amount_ ) external; function setReportIntervals( address client_, uint256 minReportInterval_, uint256 maxReportInterval_ ) external; function setSlasherHeartbeat(address client_, uint256 slasherHeartbeat_) external; function setGasPriceLimit(address client_, uint256 gasPriceLimit_) external; function setFixedCompensations( address client_, uint256 eth_, uint256 cvp_ ) external; function setBonusPlan( address client_, uint256 planId_, bool active_, uint64 bonusNominator_, uint64 bonusDenominator_, uint64 perGas_ ) external; function setMinimalDeposit(address client_, uint256 defaultMinDeposit_) external; /*** POKER INTERFACE ***/ function withdrawRewards(uint256 userId_, address to_) external; function setPokerKeyRewardWithdrawAllowance(uint256 userId_, bool allow_) external; /*** OWNER INTERFACE ***/ function addClient( address client_, address owner_, bool canSlash_, uint256 gasPriceLimit_, uint256 minReportInterval_, uint256 maxReportInterval_ ) external; function setClientActiveFlag(address client_, bool active_) external; function setCanSlashFlag(address client_, bool canSlash) external; function setOracle(address oracle_) external; function pause() external; function unpause() external; /*** GETTERS ***/ function creditOf(address client_) external view returns (uint256); function ownerOf(address client_) external view returns (address); function getMinMaxReportIntervals(address client_) external view returns (uint256 min, uint256 max); function getSlasherHeartbeat(address client_) external view returns (uint256); function getGasPriceLimit(address client_) external view returns (uint256); function getPokerBonus( address client_, uint256 bonusPlanId_, uint256 gasUsed_, uint256 userDeposit_ ) external view returns (uint256); function getGasPriceFor(address client_) external view returns (uint256); }
authorizeReporter
function authorizeReporter(uint256 userId_, address pokerKey_) external view;
/*** CLIENT'S CONTRACT INTERFACE ***/
NatSpecMultiLine
v0.6.12+commit.27d51765
MIT
ipfs://f41e0d95042138ad7054ade4b81230ad7989f38b4e8aeeb93714f20805a5f95c
{ "func_code_index": [ 65, 145 ] }
5,745
Erc20VaultPoolSwap
@powerpool/poweroracle/contracts/interfaces/IPowerPoke.sol
0x13832ea959ff5f4de001f7d4bbbd4b16f140bb76
Solidity
IPowerPoke
interface IPowerPoke { /*** CLIENT'S CONTRACT INTERFACE ***/ function authorizeReporter(uint256 userId_, address pokerKey_) external view; function authorizeNonReporter(uint256 userId_, address pokerKey_) external view; function authorizeNonReporterWithDeposit( uint256 userId_, address pokerKey_, uint256 overrideMinDeposit_ ) external view; function authorizePoker(uint256 userId_, address pokerKey_) external view; function authorizePokerWithDeposit( uint256 userId_, address pokerKey_, uint256 overrideMinStake_ ) external view; function slashReporter(uint256 slasherId_, uint256 times_) external; function reward( uint256 userId_, uint256 gasUsed_, uint256 compensationPlan_, bytes calldata pokeOptions_ ) external; /*** CLIENT OWNER INTERFACE ***/ function transferClientOwnership(address client_, address to_) external; function addCredit(address client_, uint256 amount_) external; function withdrawCredit( address client_, address to_, uint256 amount_ ) external; function setReportIntervals( address client_, uint256 minReportInterval_, uint256 maxReportInterval_ ) external; function setSlasherHeartbeat(address client_, uint256 slasherHeartbeat_) external; function setGasPriceLimit(address client_, uint256 gasPriceLimit_) external; function setFixedCompensations( address client_, uint256 eth_, uint256 cvp_ ) external; function setBonusPlan( address client_, uint256 planId_, bool active_, uint64 bonusNominator_, uint64 bonusDenominator_, uint64 perGas_ ) external; function setMinimalDeposit(address client_, uint256 defaultMinDeposit_) external; /*** POKER INTERFACE ***/ function withdrawRewards(uint256 userId_, address to_) external; function setPokerKeyRewardWithdrawAllowance(uint256 userId_, bool allow_) external; /*** OWNER INTERFACE ***/ function addClient( address client_, address owner_, bool canSlash_, uint256 gasPriceLimit_, uint256 minReportInterval_, uint256 maxReportInterval_ ) external; function setClientActiveFlag(address client_, bool active_) external; function setCanSlashFlag(address client_, bool canSlash) external; function setOracle(address oracle_) external; function pause() external; function unpause() external; /*** GETTERS ***/ function creditOf(address client_) external view returns (uint256); function ownerOf(address client_) external view returns (address); function getMinMaxReportIntervals(address client_) external view returns (uint256 min, uint256 max); function getSlasherHeartbeat(address client_) external view returns (uint256); function getGasPriceLimit(address client_) external view returns (uint256); function getPokerBonus( address client_, uint256 bonusPlanId_, uint256 gasUsed_, uint256 userDeposit_ ) external view returns (uint256); function getGasPriceFor(address client_) external view returns (uint256); }
transferClientOwnership
function transferClientOwnership(address client_, address to_) external;
/*** CLIENT OWNER INTERFACE ***/
NatSpecMultiLine
v0.6.12+commit.27d51765
MIT
ipfs://f41e0d95042138ad7054ade4b81230ad7989f38b4e8aeeb93714f20805a5f95c
{ "func_code_index": [ 855, 930 ] }
5,746
Erc20VaultPoolSwap
@powerpool/poweroracle/contracts/interfaces/IPowerPoke.sol
0x13832ea959ff5f4de001f7d4bbbd4b16f140bb76
Solidity
IPowerPoke
interface IPowerPoke { /*** CLIENT'S CONTRACT INTERFACE ***/ function authorizeReporter(uint256 userId_, address pokerKey_) external view; function authorizeNonReporter(uint256 userId_, address pokerKey_) external view; function authorizeNonReporterWithDeposit( uint256 userId_, address pokerKey_, uint256 overrideMinDeposit_ ) external view; function authorizePoker(uint256 userId_, address pokerKey_) external view; function authorizePokerWithDeposit( uint256 userId_, address pokerKey_, uint256 overrideMinStake_ ) external view; function slashReporter(uint256 slasherId_, uint256 times_) external; function reward( uint256 userId_, uint256 gasUsed_, uint256 compensationPlan_, bytes calldata pokeOptions_ ) external; /*** CLIENT OWNER INTERFACE ***/ function transferClientOwnership(address client_, address to_) external; function addCredit(address client_, uint256 amount_) external; function withdrawCredit( address client_, address to_, uint256 amount_ ) external; function setReportIntervals( address client_, uint256 minReportInterval_, uint256 maxReportInterval_ ) external; function setSlasherHeartbeat(address client_, uint256 slasherHeartbeat_) external; function setGasPriceLimit(address client_, uint256 gasPriceLimit_) external; function setFixedCompensations( address client_, uint256 eth_, uint256 cvp_ ) external; function setBonusPlan( address client_, uint256 planId_, bool active_, uint64 bonusNominator_, uint64 bonusDenominator_, uint64 perGas_ ) external; function setMinimalDeposit(address client_, uint256 defaultMinDeposit_) external; /*** POKER INTERFACE ***/ function withdrawRewards(uint256 userId_, address to_) external; function setPokerKeyRewardWithdrawAllowance(uint256 userId_, bool allow_) external; /*** OWNER INTERFACE ***/ function addClient( address client_, address owner_, bool canSlash_, uint256 gasPriceLimit_, uint256 minReportInterval_, uint256 maxReportInterval_ ) external; function setClientActiveFlag(address client_, bool active_) external; function setCanSlashFlag(address client_, bool canSlash) external; function setOracle(address oracle_) external; function pause() external; function unpause() external; /*** GETTERS ***/ function creditOf(address client_) external view returns (uint256); function ownerOf(address client_) external view returns (address); function getMinMaxReportIntervals(address client_) external view returns (uint256 min, uint256 max); function getSlasherHeartbeat(address client_) external view returns (uint256); function getGasPriceLimit(address client_) external view returns (uint256); function getPokerBonus( address client_, uint256 bonusPlanId_, uint256 gasUsed_, uint256 userDeposit_ ) external view returns (uint256); function getGasPriceFor(address client_) external view returns (uint256); }
withdrawRewards
function withdrawRewards(uint256 userId_, address to_) external;
/*** POKER INTERFACE ***/
NatSpecMultiLine
v0.6.12+commit.27d51765
MIT
ipfs://f41e0d95042138ad7054ade4b81230ad7989f38b4e8aeeb93714f20805a5f95c
{ "func_code_index": [ 1826, 1893 ] }
5,747
Erc20VaultPoolSwap
@powerpool/poweroracle/contracts/interfaces/IPowerPoke.sol
0x13832ea959ff5f4de001f7d4bbbd4b16f140bb76
Solidity
IPowerPoke
interface IPowerPoke { /*** CLIENT'S CONTRACT INTERFACE ***/ function authorizeReporter(uint256 userId_, address pokerKey_) external view; function authorizeNonReporter(uint256 userId_, address pokerKey_) external view; function authorizeNonReporterWithDeposit( uint256 userId_, address pokerKey_, uint256 overrideMinDeposit_ ) external view; function authorizePoker(uint256 userId_, address pokerKey_) external view; function authorizePokerWithDeposit( uint256 userId_, address pokerKey_, uint256 overrideMinStake_ ) external view; function slashReporter(uint256 slasherId_, uint256 times_) external; function reward( uint256 userId_, uint256 gasUsed_, uint256 compensationPlan_, bytes calldata pokeOptions_ ) external; /*** CLIENT OWNER INTERFACE ***/ function transferClientOwnership(address client_, address to_) external; function addCredit(address client_, uint256 amount_) external; function withdrawCredit( address client_, address to_, uint256 amount_ ) external; function setReportIntervals( address client_, uint256 minReportInterval_, uint256 maxReportInterval_ ) external; function setSlasherHeartbeat(address client_, uint256 slasherHeartbeat_) external; function setGasPriceLimit(address client_, uint256 gasPriceLimit_) external; function setFixedCompensations( address client_, uint256 eth_, uint256 cvp_ ) external; function setBonusPlan( address client_, uint256 planId_, bool active_, uint64 bonusNominator_, uint64 bonusDenominator_, uint64 perGas_ ) external; function setMinimalDeposit(address client_, uint256 defaultMinDeposit_) external; /*** POKER INTERFACE ***/ function withdrawRewards(uint256 userId_, address to_) external; function setPokerKeyRewardWithdrawAllowance(uint256 userId_, bool allow_) external; /*** OWNER INTERFACE ***/ function addClient( address client_, address owner_, bool canSlash_, uint256 gasPriceLimit_, uint256 minReportInterval_, uint256 maxReportInterval_ ) external; function setClientActiveFlag(address client_, bool active_) external; function setCanSlashFlag(address client_, bool canSlash) external; function setOracle(address oracle_) external; function pause() external; function unpause() external; /*** GETTERS ***/ function creditOf(address client_) external view returns (uint256); function ownerOf(address client_) external view returns (address); function getMinMaxReportIntervals(address client_) external view returns (uint256 min, uint256 max); function getSlasherHeartbeat(address client_) external view returns (uint256); function getGasPriceLimit(address client_) external view returns (uint256); function getPokerBonus( address client_, uint256 bonusPlanId_, uint256 gasUsed_, uint256 userDeposit_ ) external view returns (uint256); function getGasPriceFor(address client_) external view returns (uint256); }
addClient
function addClient( address client_, address owner_, bool canSlash_, uint256 gasPriceLimit_, uint256 minReportInterval_, uint256 maxReportInterval_ ) external;
/*** OWNER INTERFACE ***/
NatSpecMultiLine
v0.6.12+commit.27d51765
MIT
ipfs://f41e0d95042138ad7054ade4b81230ad7989f38b4e8aeeb93714f20805a5f95c
{ "func_code_index": [ 2014, 2209 ] }
5,748
Erc20VaultPoolSwap
@powerpool/poweroracle/contracts/interfaces/IPowerPoke.sol
0x13832ea959ff5f4de001f7d4bbbd4b16f140bb76
Solidity
IPowerPoke
interface IPowerPoke { /*** CLIENT'S CONTRACT INTERFACE ***/ function authorizeReporter(uint256 userId_, address pokerKey_) external view; function authorizeNonReporter(uint256 userId_, address pokerKey_) external view; function authorizeNonReporterWithDeposit( uint256 userId_, address pokerKey_, uint256 overrideMinDeposit_ ) external view; function authorizePoker(uint256 userId_, address pokerKey_) external view; function authorizePokerWithDeposit( uint256 userId_, address pokerKey_, uint256 overrideMinStake_ ) external view; function slashReporter(uint256 slasherId_, uint256 times_) external; function reward( uint256 userId_, uint256 gasUsed_, uint256 compensationPlan_, bytes calldata pokeOptions_ ) external; /*** CLIENT OWNER INTERFACE ***/ function transferClientOwnership(address client_, address to_) external; function addCredit(address client_, uint256 amount_) external; function withdrawCredit( address client_, address to_, uint256 amount_ ) external; function setReportIntervals( address client_, uint256 minReportInterval_, uint256 maxReportInterval_ ) external; function setSlasherHeartbeat(address client_, uint256 slasherHeartbeat_) external; function setGasPriceLimit(address client_, uint256 gasPriceLimit_) external; function setFixedCompensations( address client_, uint256 eth_, uint256 cvp_ ) external; function setBonusPlan( address client_, uint256 planId_, bool active_, uint64 bonusNominator_, uint64 bonusDenominator_, uint64 perGas_ ) external; function setMinimalDeposit(address client_, uint256 defaultMinDeposit_) external; /*** POKER INTERFACE ***/ function withdrawRewards(uint256 userId_, address to_) external; function setPokerKeyRewardWithdrawAllowance(uint256 userId_, bool allow_) external; /*** OWNER INTERFACE ***/ function addClient( address client_, address owner_, bool canSlash_, uint256 gasPriceLimit_, uint256 minReportInterval_, uint256 maxReportInterval_ ) external; function setClientActiveFlag(address client_, bool active_) external; function setCanSlashFlag(address client_, bool canSlash) external; function setOracle(address oracle_) external; function pause() external; function unpause() external; /*** GETTERS ***/ function creditOf(address client_) external view returns (uint256); function ownerOf(address client_) external view returns (address); function getMinMaxReportIntervals(address client_) external view returns (uint256 min, uint256 max); function getSlasherHeartbeat(address client_) external view returns (uint256); function getGasPriceLimit(address client_) external view returns (uint256); function getPokerBonus( address client_, uint256 bonusPlanId_, uint256 gasUsed_, uint256 userDeposit_ ) external view returns (uint256); function getGasPriceFor(address client_) external view returns (uint256); }
creditOf
function creditOf(address client_) external view returns (uint256);
/*** GETTERS ***/
NatSpecMultiLine
v0.6.12+commit.27d51765
MIT
ipfs://f41e0d95042138ad7054ade4b81230ad7989f38b4e8aeeb93714f20805a5f95c
{ "func_code_index": [ 2497, 2567 ] }
5,749
WE
WE.sol
0xf445218a9b8a4a8ec7d5b44fa0c9cf6361e43fa8
Solidity
WE
contract WE is SafeMath{ string public name; string public symbol; uint8 public decimals; uint256 public totalSupply; address public owner; /* This creates an array with all balances */ mapping (address => uint256) public balanceOf; mapping (address => uint256) public freezeOf; 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); /* This notifies clients about the amount frozen */ event Freeze(address indexed from, uint256 value); /* This notifies clients about the amount unfrozen */ event Unfreeze(address indexed from, uint256 value); /* Initializes contract with initial supply tokens to the creator of the contract */ function WE( uint256 initialSupply, string tokenName, uint8 decimalUnits, string tokenSymbol ) { balanceOf[msg.sender] = initialSupply; // Give the creator all initial tokens totalSupply = initialSupply; // Update total supply name = tokenName; // Set the name for display purposes symbol = tokenSymbol; // Set the symbol for display purposes decimals = decimalUnits; // Amount of decimals for display purposes owner = msg.sender; } /* Send coins */ function transfer(address _to, uint256 _value) { if (_to == 0x0) throw; // Prevent transfer to 0x0 address. Use burn() instead if (_value <= 0) throw; if (balanceOf[msg.sender] < _value) throw; // Check if the sender has enough if (balanceOf[_to] + _value < balanceOf[_to]) throw; // Check for overflows balanceOf[msg.sender] = SafeMath.safeSub(balanceOf[msg.sender], _value); // Subtract from the sender balanceOf[_to] = SafeMath.safeAdd(balanceOf[_to], _value); // Add the same to the recipient Transfer(msg.sender, _to, _value); // Notify anyone listening that this transfer took place } /* Allow another contract to spend some tokens in your behalf */ function approve(address _spender, uint256 _value) returns (bool success) { if (_value <= 0) throw; allowance[msg.sender][_spender] = _value; return true; } /* A contract attempts to get the coins */ function transferFrom(address _from, address _to, uint256 _value) returns (bool success) { if (_to == 0x0) throw; // Prevent transfer to 0x0 address. Use burn() instead if (_value <= 0) throw; if (balanceOf[_from] < _value) throw; // Check if the sender has enough if (balanceOf[_to] + _value < balanceOf[_to]) throw; // Check for overflows if (_value > allowance[_from][msg.sender]) throw; // Check allowance balanceOf[_from] = SafeMath.safeSub(balanceOf[_from], _value); // Subtract from the sender balanceOf[_to] = SafeMath.safeAdd(balanceOf[_to], _value); // Add the same to the recipient allowance[_from][msg.sender] = SafeMath.safeSub(allowance[_from][msg.sender], _value); Transfer(_from, _to, _value); return true; } function burn(uint256 _value) returns (bool success) { if (balanceOf[msg.sender] < _value) throw; // Check if the sender has enough if (_value <= 0) throw; balanceOf[msg.sender] = SafeMath.safeSub(balanceOf[msg.sender], _value); // Subtract from the sender totalSupply = SafeMath.safeSub(totalSupply,_value); // Updates totalSupply Burn(msg.sender, _value); return true; } function freeze(uint256 _value) returns (bool success) { if (balanceOf[msg.sender] < _value) throw; // Check if the sender has enough if (_value <= 0) throw; balanceOf[msg.sender] = SafeMath.safeSub(balanceOf[msg.sender], _value); // Subtract from the sender freezeOf[msg.sender] = SafeMath.safeAdd(freezeOf[msg.sender], _value); // Updates totalSupply Freeze(msg.sender, _value); return true; } function unfreeze(uint256 _value) returns (bool success) { if (freezeOf[msg.sender] < _value) throw; // Check if the sender has enough if (_value <= 0) throw; freezeOf[msg.sender] = SafeMath.safeSub(freezeOf[msg.sender], _value); // Subtract from the sender balanceOf[msg.sender] = SafeMath.safeAdd(balanceOf[msg.sender], _value); Unfreeze(msg.sender, _value); return true; } // transfer balance to owner function withdrawEther(uint256 amount) { if(msg.sender != owner)throw; owner.transfer(amount); } // can accept ether function() payable { } }
WE
function WE( uint256 initialSupply, string tokenName, uint8 decimalUnits, string tokenSymbol ) { balanceOf[msg.sender] = initialSupply; // Give the creator all initial tokens totalSupply = initialSupply; // Update total supply name = tokenName; // Set the name for display purposes symbol = tokenSymbol; // Set the symbol for display purposes decimals = decimalUnits; // Amount of decimals for display purposes ner = msg.sender; }
/* Initializes contract with initial supply tokens to the creator of the contract */
Comment
v0.4.23+commit.124ca40d
bzzr://db8a5bbdbd91d8ec14a49aa013554dc0f96a79107b7304abe1dfa33e7afa228f
{ "func_code_index": [ 987, 1649 ] }
5,750
WE
WE.sol
0xf445218a9b8a4a8ec7d5b44fa0c9cf6361e43fa8
Solidity
WE
contract WE is SafeMath{ string public name; string public symbol; uint8 public decimals; uint256 public totalSupply; address public owner; /* This creates an array with all balances */ mapping (address => uint256) public balanceOf; mapping (address => uint256) public freezeOf; 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); /* This notifies clients about the amount frozen */ event Freeze(address indexed from, uint256 value); /* This notifies clients about the amount unfrozen */ event Unfreeze(address indexed from, uint256 value); /* Initializes contract with initial supply tokens to the creator of the contract */ function WE( uint256 initialSupply, string tokenName, uint8 decimalUnits, string tokenSymbol ) { balanceOf[msg.sender] = initialSupply; // Give the creator all initial tokens totalSupply = initialSupply; // Update total supply name = tokenName; // Set the name for display purposes symbol = tokenSymbol; // Set the symbol for display purposes decimals = decimalUnits; // Amount of decimals for display purposes owner = msg.sender; } /* Send coins */ function transfer(address _to, uint256 _value) { if (_to == 0x0) throw; // Prevent transfer to 0x0 address. Use burn() instead if (_value <= 0) throw; if (balanceOf[msg.sender] < _value) throw; // Check if the sender has enough if (balanceOf[_to] + _value < balanceOf[_to]) throw; // Check for overflows balanceOf[msg.sender] = SafeMath.safeSub(balanceOf[msg.sender], _value); // Subtract from the sender balanceOf[_to] = SafeMath.safeAdd(balanceOf[_to], _value); // Add the same to the recipient Transfer(msg.sender, _to, _value); // Notify anyone listening that this transfer took place } /* Allow another contract to spend some tokens in your behalf */ function approve(address _spender, uint256 _value) returns (bool success) { if (_value <= 0) throw; allowance[msg.sender][_spender] = _value; return true; } /* A contract attempts to get the coins */ function transferFrom(address _from, address _to, uint256 _value) returns (bool success) { if (_to == 0x0) throw; // Prevent transfer to 0x0 address. Use burn() instead if (_value <= 0) throw; if (balanceOf[_from] < _value) throw; // Check if the sender has enough if (balanceOf[_to] + _value < balanceOf[_to]) throw; // Check for overflows if (_value > allowance[_from][msg.sender]) throw; // Check allowance balanceOf[_from] = SafeMath.safeSub(balanceOf[_from], _value); // Subtract from the sender balanceOf[_to] = SafeMath.safeAdd(balanceOf[_to], _value); // Add the same to the recipient allowance[_from][msg.sender] = SafeMath.safeSub(allowance[_from][msg.sender], _value); Transfer(_from, _to, _value); return true; } function burn(uint256 _value) returns (bool success) { if (balanceOf[msg.sender] < _value) throw; // Check if the sender has enough if (_value <= 0) throw; balanceOf[msg.sender] = SafeMath.safeSub(balanceOf[msg.sender], _value); // Subtract from the sender totalSupply = SafeMath.safeSub(totalSupply,_value); // Updates totalSupply Burn(msg.sender, _value); return true; } function freeze(uint256 _value) returns (bool success) { if (balanceOf[msg.sender] < _value) throw; // Check if the sender has enough if (_value <= 0) throw; balanceOf[msg.sender] = SafeMath.safeSub(balanceOf[msg.sender], _value); // Subtract from the sender freezeOf[msg.sender] = SafeMath.safeAdd(freezeOf[msg.sender], _value); // Updates totalSupply Freeze(msg.sender, _value); return true; } function unfreeze(uint256 _value) returns (bool success) { if (freezeOf[msg.sender] < _value) throw; // Check if the sender has enough if (_value <= 0) throw; freezeOf[msg.sender] = SafeMath.safeSub(freezeOf[msg.sender], _value); // Subtract from the sender balanceOf[msg.sender] = SafeMath.safeAdd(balanceOf[msg.sender], _value); Unfreeze(msg.sender, _value); return true; } // transfer balance to owner function withdrawEther(uint256 amount) { if(msg.sender != owner)throw; owner.transfer(amount); } // can accept ether function() payable { } }
transfer
function transfer(address _to, uint256 _value) { if (_to == 0x0) throw; // Prevent transfer to 0x0 address. Use burn() instead (_value <= 0) throw; if (balanceOf[msg.sender] < _value) throw; // Check if the sender has enough if (balanceOf[_to] + _value < balanceOf[_to]) throw; // Check for overflows balanceOf[msg.sender] = SafeMath.safeSub(balanceOf[msg.sender], _value); // Subtract from the sender balanceOf[_to] = SafeMath.safeAdd(balanceOf[_to], _value); // Add the same to the recipient Transfer(msg.sender, _to, _value); // Notify anyone listening that this transfer took place }
/* Send coins */
Comment
v0.4.23+commit.124ca40d
bzzr://db8a5bbdbd91d8ec14a49aa013554dc0f96a79107b7304abe1dfa33e7afa228f
{ "func_code_index": [ 1674, 2437 ] }
5,751
WE
WE.sol
0xf445218a9b8a4a8ec7d5b44fa0c9cf6361e43fa8
Solidity
WE
contract WE is SafeMath{ string public name; string public symbol; uint8 public decimals; uint256 public totalSupply; address public owner; /* This creates an array with all balances */ mapping (address => uint256) public balanceOf; mapping (address => uint256) public freezeOf; 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); /* This notifies clients about the amount frozen */ event Freeze(address indexed from, uint256 value); /* This notifies clients about the amount unfrozen */ event Unfreeze(address indexed from, uint256 value); /* Initializes contract with initial supply tokens to the creator of the contract */ function WE( uint256 initialSupply, string tokenName, uint8 decimalUnits, string tokenSymbol ) { balanceOf[msg.sender] = initialSupply; // Give the creator all initial tokens totalSupply = initialSupply; // Update total supply name = tokenName; // Set the name for display purposes symbol = tokenSymbol; // Set the symbol for display purposes decimals = decimalUnits; // Amount of decimals for display purposes owner = msg.sender; } /* Send coins */ function transfer(address _to, uint256 _value) { if (_to == 0x0) throw; // Prevent transfer to 0x0 address. Use burn() instead if (_value <= 0) throw; if (balanceOf[msg.sender] < _value) throw; // Check if the sender has enough if (balanceOf[_to] + _value < balanceOf[_to]) throw; // Check for overflows balanceOf[msg.sender] = SafeMath.safeSub(balanceOf[msg.sender], _value); // Subtract from the sender balanceOf[_to] = SafeMath.safeAdd(balanceOf[_to], _value); // Add the same to the recipient Transfer(msg.sender, _to, _value); // Notify anyone listening that this transfer took place } /* Allow another contract to spend some tokens in your behalf */ function approve(address _spender, uint256 _value) returns (bool success) { if (_value <= 0) throw; allowance[msg.sender][_spender] = _value; return true; } /* A contract attempts to get the coins */ function transferFrom(address _from, address _to, uint256 _value) returns (bool success) { if (_to == 0x0) throw; // Prevent transfer to 0x0 address. Use burn() instead if (_value <= 0) throw; if (balanceOf[_from] < _value) throw; // Check if the sender has enough if (balanceOf[_to] + _value < balanceOf[_to]) throw; // Check for overflows if (_value > allowance[_from][msg.sender]) throw; // Check allowance balanceOf[_from] = SafeMath.safeSub(balanceOf[_from], _value); // Subtract from the sender balanceOf[_to] = SafeMath.safeAdd(balanceOf[_to], _value); // Add the same to the recipient allowance[_from][msg.sender] = SafeMath.safeSub(allowance[_from][msg.sender], _value); Transfer(_from, _to, _value); return true; } function burn(uint256 _value) returns (bool success) { if (balanceOf[msg.sender] < _value) throw; // Check if the sender has enough if (_value <= 0) throw; balanceOf[msg.sender] = SafeMath.safeSub(balanceOf[msg.sender], _value); // Subtract from the sender totalSupply = SafeMath.safeSub(totalSupply,_value); // Updates totalSupply Burn(msg.sender, _value); return true; } function freeze(uint256 _value) returns (bool success) { if (balanceOf[msg.sender] < _value) throw; // Check if the sender has enough if (_value <= 0) throw; balanceOf[msg.sender] = SafeMath.safeSub(balanceOf[msg.sender], _value); // Subtract from the sender freezeOf[msg.sender] = SafeMath.safeAdd(freezeOf[msg.sender], _value); // Updates totalSupply Freeze(msg.sender, _value); return true; } function unfreeze(uint256 _value) returns (bool success) { if (freezeOf[msg.sender] < _value) throw; // Check if the sender has enough if (_value <= 0) throw; freezeOf[msg.sender] = SafeMath.safeSub(freezeOf[msg.sender], _value); // Subtract from the sender balanceOf[msg.sender] = SafeMath.safeAdd(balanceOf[msg.sender], _value); Unfreeze(msg.sender, _value); return true; } // transfer balance to owner function withdrawEther(uint256 amount) { if(msg.sender != owner)throw; owner.transfer(amount); } // can accept ether function() payable { } }
approve
function approve(address _spender, uint256 _value) returns (bool success) { (_value <= 0) throw; allowance[msg.sender][_spender] = _value; return true; }
/* Allow another contract to spend some tokens in your behalf */
Comment
v0.4.23+commit.124ca40d
bzzr://db8a5bbdbd91d8ec14a49aa013554dc0f96a79107b7304abe1dfa33e7afa228f
{ "func_code_index": [ 2510, 2707 ] }
5,752
WE
WE.sol
0xf445218a9b8a4a8ec7d5b44fa0c9cf6361e43fa8
Solidity
WE
contract WE is SafeMath{ string public name; string public symbol; uint8 public decimals; uint256 public totalSupply; address public owner; /* This creates an array with all balances */ mapping (address => uint256) public balanceOf; mapping (address => uint256) public freezeOf; 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); /* This notifies clients about the amount frozen */ event Freeze(address indexed from, uint256 value); /* This notifies clients about the amount unfrozen */ event Unfreeze(address indexed from, uint256 value); /* Initializes contract with initial supply tokens to the creator of the contract */ function WE( uint256 initialSupply, string tokenName, uint8 decimalUnits, string tokenSymbol ) { balanceOf[msg.sender] = initialSupply; // Give the creator all initial tokens totalSupply = initialSupply; // Update total supply name = tokenName; // Set the name for display purposes symbol = tokenSymbol; // Set the symbol for display purposes decimals = decimalUnits; // Amount of decimals for display purposes owner = msg.sender; } /* Send coins */ function transfer(address _to, uint256 _value) { if (_to == 0x0) throw; // Prevent transfer to 0x0 address. Use burn() instead if (_value <= 0) throw; if (balanceOf[msg.sender] < _value) throw; // Check if the sender has enough if (balanceOf[_to] + _value < balanceOf[_to]) throw; // Check for overflows balanceOf[msg.sender] = SafeMath.safeSub(balanceOf[msg.sender], _value); // Subtract from the sender balanceOf[_to] = SafeMath.safeAdd(balanceOf[_to], _value); // Add the same to the recipient Transfer(msg.sender, _to, _value); // Notify anyone listening that this transfer took place } /* Allow another contract to spend some tokens in your behalf */ function approve(address _spender, uint256 _value) returns (bool success) { if (_value <= 0) throw; allowance[msg.sender][_spender] = _value; return true; } /* A contract attempts to get the coins */ function transferFrom(address _from, address _to, uint256 _value) returns (bool success) { if (_to == 0x0) throw; // Prevent transfer to 0x0 address. Use burn() instead if (_value <= 0) throw; if (balanceOf[_from] < _value) throw; // Check if the sender has enough if (balanceOf[_to] + _value < balanceOf[_to]) throw; // Check for overflows if (_value > allowance[_from][msg.sender]) throw; // Check allowance balanceOf[_from] = SafeMath.safeSub(balanceOf[_from], _value); // Subtract from the sender balanceOf[_to] = SafeMath.safeAdd(balanceOf[_to], _value); // Add the same to the recipient allowance[_from][msg.sender] = SafeMath.safeSub(allowance[_from][msg.sender], _value); Transfer(_from, _to, _value); return true; } function burn(uint256 _value) returns (bool success) { if (balanceOf[msg.sender] < _value) throw; // Check if the sender has enough if (_value <= 0) throw; balanceOf[msg.sender] = SafeMath.safeSub(balanceOf[msg.sender], _value); // Subtract from the sender totalSupply = SafeMath.safeSub(totalSupply,_value); // Updates totalSupply Burn(msg.sender, _value); return true; } function freeze(uint256 _value) returns (bool success) { if (balanceOf[msg.sender] < _value) throw; // Check if the sender has enough if (_value <= 0) throw; balanceOf[msg.sender] = SafeMath.safeSub(balanceOf[msg.sender], _value); // Subtract from the sender freezeOf[msg.sender] = SafeMath.safeAdd(freezeOf[msg.sender], _value); // Updates totalSupply Freeze(msg.sender, _value); return true; } function unfreeze(uint256 _value) returns (bool success) { if (freezeOf[msg.sender] < _value) throw; // Check if the sender has enough if (_value <= 0) throw; freezeOf[msg.sender] = SafeMath.safeSub(freezeOf[msg.sender], _value); // Subtract from the sender balanceOf[msg.sender] = SafeMath.safeAdd(balanceOf[msg.sender], _value); Unfreeze(msg.sender, _value); return true; } // transfer balance to owner function withdrawEther(uint256 amount) { if(msg.sender != owner)throw; owner.transfer(amount); } // can accept ether function() payable { } }
transferFrom
function transferFrom(address _from, address _to, uint256 _value) returns (bool success) { if (_to == 0x0) throw; // Prevent transfer to 0x0 address. Use burn() instead (_value <= 0) throw; if (balanceOf[_from] < _value) throw; // Check if the sender has enough if (balanceOf[_to] + _value < balanceOf[_to]) throw; // Check for overflows if (_value > allowance[_from][msg.sender]) throw; // Check allowance balanceOf[_from] = SafeMath.safeSub(balanceOf[_from], _value); // Subtract from the sender balanceOf[_to] = SafeMath.safeAdd(balanceOf[_to], _value); // Add the same to the recipient allowance[_from][msg.sender] = SafeMath.safeSub(allowance[_from][msg.sender], _value); Transfer(_from, _to, _value); return true; }
/* A contract attempts to get the coins */
Comment
v0.4.23+commit.124ca40d
bzzr://db8a5bbdbd91d8ec14a49aa013554dc0f96a79107b7304abe1dfa33e7afa228f
{ "func_code_index": [ 2767, 3692 ] }
5,753
WE
WE.sol
0xf445218a9b8a4a8ec7d5b44fa0c9cf6361e43fa8
Solidity
WE
contract WE is SafeMath{ string public name; string public symbol; uint8 public decimals; uint256 public totalSupply; address public owner; /* This creates an array with all balances */ mapping (address => uint256) public balanceOf; mapping (address => uint256) public freezeOf; 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); /* This notifies clients about the amount frozen */ event Freeze(address indexed from, uint256 value); /* This notifies clients about the amount unfrozen */ event Unfreeze(address indexed from, uint256 value); /* Initializes contract with initial supply tokens to the creator of the contract */ function WE( uint256 initialSupply, string tokenName, uint8 decimalUnits, string tokenSymbol ) { balanceOf[msg.sender] = initialSupply; // Give the creator all initial tokens totalSupply = initialSupply; // Update total supply name = tokenName; // Set the name for display purposes symbol = tokenSymbol; // Set the symbol for display purposes decimals = decimalUnits; // Amount of decimals for display purposes owner = msg.sender; } /* Send coins */ function transfer(address _to, uint256 _value) { if (_to == 0x0) throw; // Prevent transfer to 0x0 address. Use burn() instead if (_value <= 0) throw; if (balanceOf[msg.sender] < _value) throw; // Check if the sender has enough if (balanceOf[_to] + _value < balanceOf[_to]) throw; // Check for overflows balanceOf[msg.sender] = SafeMath.safeSub(balanceOf[msg.sender], _value); // Subtract from the sender balanceOf[_to] = SafeMath.safeAdd(balanceOf[_to], _value); // Add the same to the recipient Transfer(msg.sender, _to, _value); // Notify anyone listening that this transfer took place } /* Allow another contract to spend some tokens in your behalf */ function approve(address _spender, uint256 _value) returns (bool success) { if (_value <= 0) throw; allowance[msg.sender][_spender] = _value; return true; } /* A contract attempts to get the coins */ function transferFrom(address _from, address _to, uint256 _value) returns (bool success) { if (_to == 0x0) throw; // Prevent transfer to 0x0 address. Use burn() instead if (_value <= 0) throw; if (balanceOf[_from] < _value) throw; // Check if the sender has enough if (balanceOf[_to] + _value < balanceOf[_to]) throw; // Check for overflows if (_value > allowance[_from][msg.sender]) throw; // Check allowance balanceOf[_from] = SafeMath.safeSub(balanceOf[_from], _value); // Subtract from the sender balanceOf[_to] = SafeMath.safeAdd(balanceOf[_to], _value); // Add the same to the recipient allowance[_from][msg.sender] = SafeMath.safeSub(allowance[_from][msg.sender], _value); Transfer(_from, _to, _value); return true; } function burn(uint256 _value) returns (bool success) { if (balanceOf[msg.sender] < _value) throw; // Check if the sender has enough if (_value <= 0) throw; balanceOf[msg.sender] = SafeMath.safeSub(balanceOf[msg.sender], _value); // Subtract from the sender totalSupply = SafeMath.safeSub(totalSupply,_value); // Updates totalSupply Burn(msg.sender, _value); return true; } function freeze(uint256 _value) returns (bool success) { if (balanceOf[msg.sender] < _value) throw; // Check if the sender has enough if (_value <= 0) throw; balanceOf[msg.sender] = SafeMath.safeSub(balanceOf[msg.sender], _value); // Subtract from the sender freezeOf[msg.sender] = SafeMath.safeAdd(freezeOf[msg.sender], _value); // Updates totalSupply Freeze(msg.sender, _value); return true; } function unfreeze(uint256 _value) returns (bool success) { if (freezeOf[msg.sender] < _value) throw; // Check if the sender has enough if (_value <= 0) throw; freezeOf[msg.sender] = SafeMath.safeSub(freezeOf[msg.sender], _value); // Subtract from the sender balanceOf[msg.sender] = SafeMath.safeAdd(balanceOf[msg.sender], _value); Unfreeze(msg.sender, _value); return true; } // transfer balance to owner function withdrawEther(uint256 amount) { if(msg.sender != owner)throw; owner.transfer(amount); } // can accept ether function() payable { } }
withdrawEther
function withdrawEther(uint256 amount) { if(msg.sender != owner)throw; owner.transfer(amount); }
// transfer balance to owner
LineComment
v0.4.23+commit.124ca40d
bzzr://db8a5bbdbd91d8ec14a49aa013554dc0f96a79107b7304abe1dfa33e7afa228f
{ "func_code_index": [ 5203, 5309 ] }
5,754
WE
WE.sol
0xf445218a9b8a4a8ec7d5b44fa0c9cf6361e43fa8
Solidity
WE
contract WE is SafeMath{ string public name; string public symbol; uint8 public decimals; uint256 public totalSupply; address public owner; /* This creates an array with all balances */ mapping (address => uint256) public balanceOf; mapping (address => uint256) public freezeOf; 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); /* This notifies clients about the amount frozen */ event Freeze(address indexed from, uint256 value); /* This notifies clients about the amount unfrozen */ event Unfreeze(address indexed from, uint256 value); /* Initializes contract with initial supply tokens to the creator of the contract */ function WE( uint256 initialSupply, string tokenName, uint8 decimalUnits, string tokenSymbol ) { balanceOf[msg.sender] = initialSupply; // Give the creator all initial tokens totalSupply = initialSupply; // Update total supply name = tokenName; // Set the name for display purposes symbol = tokenSymbol; // Set the symbol for display purposes decimals = decimalUnits; // Amount of decimals for display purposes owner = msg.sender; } /* Send coins */ function transfer(address _to, uint256 _value) { if (_to == 0x0) throw; // Prevent transfer to 0x0 address. Use burn() instead if (_value <= 0) throw; if (balanceOf[msg.sender] < _value) throw; // Check if the sender has enough if (balanceOf[_to] + _value < balanceOf[_to]) throw; // Check for overflows balanceOf[msg.sender] = SafeMath.safeSub(balanceOf[msg.sender], _value); // Subtract from the sender balanceOf[_to] = SafeMath.safeAdd(balanceOf[_to], _value); // Add the same to the recipient Transfer(msg.sender, _to, _value); // Notify anyone listening that this transfer took place } /* Allow another contract to spend some tokens in your behalf */ function approve(address _spender, uint256 _value) returns (bool success) { if (_value <= 0) throw; allowance[msg.sender][_spender] = _value; return true; } /* A contract attempts to get the coins */ function transferFrom(address _from, address _to, uint256 _value) returns (bool success) { if (_to == 0x0) throw; // Prevent transfer to 0x0 address. Use burn() instead if (_value <= 0) throw; if (balanceOf[_from] < _value) throw; // Check if the sender has enough if (balanceOf[_to] + _value < balanceOf[_to]) throw; // Check for overflows if (_value > allowance[_from][msg.sender]) throw; // Check allowance balanceOf[_from] = SafeMath.safeSub(balanceOf[_from], _value); // Subtract from the sender balanceOf[_to] = SafeMath.safeAdd(balanceOf[_to], _value); // Add the same to the recipient allowance[_from][msg.sender] = SafeMath.safeSub(allowance[_from][msg.sender], _value); Transfer(_from, _to, _value); return true; } function burn(uint256 _value) returns (bool success) { if (balanceOf[msg.sender] < _value) throw; // Check if the sender has enough if (_value <= 0) throw; balanceOf[msg.sender] = SafeMath.safeSub(balanceOf[msg.sender], _value); // Subtract from the sender totalSupply = SafeMath.safeSub(totalSupply,_value); // Updates totalSupply Burn(msg.sender, _value); return true; } function freeze(uint256 _value) returns (bool success) { if (balanceOf[msg.sender] < _value) throw; // Check if the sender has enough if (_value <= 0) throw; balanceOf[msg.sender] = SafeMath.safeSub(balanceOf[msg.sender], _value); // Subtract from the sender freezeOf[msg.sender] = SafeMath.safeAdd(freezeOf[msg.sender], _value); // Updates totalSupply Freeze(msg.sender, _value); return true; } function unfreeze(uint256 _value) returns (bool success) { if (freezeOf[msg.sender] < _value) throw; // Check if the sender has enough if (_value <= 0) throw; freezeOf[msg.sender] = SafeMath.safeSub(freezeOf[msg.sender], _value); // Subtract from the sender balanceOf[msg.sender] = SafeMath.safeAdd(balanceOf[msg.sender], _value); Unfreeze(msg.sender, _value); return true; } // transfer balance to owner function withdrawEther(uint256 amount) { if(msg.sender != owner)throw; owner.transfer(amount); } // can accept ether function() payable { } }
function() payable { }
// can accept ether
LineComment
v0.4.23+commit.124ca40d
bzzr://db8a5bbdbd91d8ec14a49aa013554dc0f96a79107b7304abe1dfa33e7afa228f
{ "func_code_index": [ 5335, 5364 ] }
5,755
PrizeFlush
@pooltogether/v4-periphery/contracts/PrizeFlush.sol
0x2193b28b2bdfbf805506c9d91ed2021ba6fbc888
Solidity
PrizeFlush
contract PrizeFlush is IPrizeFlush, Manageable { /** * @notice Destination address for captured interest. * @dev Should be set to the PrizeDistributor address. */ address internal destination; /// @notice Reserve address. IReserve internal reserve; /// @notice Strategy address. IStrategy internal strategy; /** * @notice Emitted when contract has been deployed. * @param destination Destination address * @param reserve Strategy address * @param strategy Reserve address * */ event Deployed( address indexed destination, IReserve indexed reserve, IStrategy indexed strategy ); /* ============ Constructor ============ */ /** * @notice Deploy Prize Flush. * @param _owner Prize Flush owner address * @param _destination Destination address * @param _strategy Strategy address * @param _reserve Reserve address * */ constructor( address _owner, address _destination, IStrategy _strategy, IReserve _reserve ) Ownable(_owner) { _setDestination(_destination); _setReserve(_reserve); _setStrategy(_strategy); emit Deployed(_destination, _reserve, _strategy); } /* ============ External Functions ============ */ /// @inheritdoc IPrizeFlush function getDestination() external view override returns (address) { return destination; } /// @inheritdoc IPrizeFlush function getReserve() external view override returns (IReserve) { return reserve; } /// @inheritdoc IPrizeFlush function getStrategy() external view override returns (IStrategy) { return strategy; } /// @inheritdoc IPrizeFlush function setDestination(address _destination) external override onlyOwner returns (address) { _setDestination(_destination); emit DestinationSet(_destination); return _destination; } /// @inheritdoc IPrizeFlush function setReserve(IReserve _reserve) external override onlyOwner returns (IReserve) { _setReserve(_reserve); emit ReserveSet(_reserve); return _reserve; } /// @inheritdoc IPrizeFlush function setStrategy(IStrategy _strategy) external override onlyOwner returns (IStrategy) { _setStrategy(_strategy); emit StrategySet(_strategy); return _strategy; } /// @inheritdoc IPrizeFlush function flush() external override onlyManagerOrOwner returns (bool) { // Captures interest from PrizePool and distributes funds using a PrizeSplitStrategy. strategy.distribute(); // After funds are distributed using PrizeSplitStrategy we EXPECT funds to be located in the Reserve. IReserve _reserve = reserve; IERC20 _token = _reserve.getToken(); uint256 _amount = _token.balanceOf(address(_reserve)); // IF the tokens were succesfully moved to the Reserve, now move them to the destination (PrizeDistributor) address. if (_amount > 0) { address _destination = destination; // Create checkpoint and transfers new total balance to PrizeDistributor _reserve.withdrawTo(_destination, _amount); emit Flushed(_destination, _amount); return true; } return false; } /* ============ Internal Functions ============ */ /** * @notice Set global destination variable. * @dev `_destination` cannot be the zero address. * @param _destination Destination address */ function _setDestination(address _destination) internal { require(_destination != address(0), "Flush/destination-not-zero-address"); destination = _destination; } /** * @notice Set global reserve variable. * @dev `_reserve` cannot be the zero address. * @param _reserve Reserve address */ function _setReserve(IReserve _reserve) internal { require(address(_reserve) != address(0), "Flush/reserve-not-zero-address"); reserve = _reserve; } /** * @notice Set global strategy variable. * @dev `_strategy` cannot be the zero address. * @param _strategy Strategy address */ function _setStrategy(IStrategy _strategy) internal { require(address(_strategy) != address(0), "Flush/strategy-not-zero-address"); strategy = _strategy; } }
/** * @title PoolTogether V4 PrizeFlush * @author PoolTogether Inc Team * @notice The PrizeFlush contract helps capture interest from the PrizePool and move collected funds to a designated PrizeDistributor contract. When deployed, the destination, reserve and strategy addresses are set and used as static parameters during every "flush" execution. The parameters can be reset by the Owner if necessary. */
NatSpecMultiLine
getDestination
function getDestination() external view override returns (address) { return destination; }
/// @inheritdoc IPrizeFlush
NatSpecSingleLine
v0.8.6+commit.11564f7e
GNU GPLv3
{ "func_code_index": [ 1375, 1481 ] }
5,756
PrizeFlush
@pooltogether/v4-periphery/contracts/PrizeFlush.sol
0x2193b28b2bdfbf805506c9d91ed2021ba6fbc888
Solidity
PrizeFlush
contract PrizeFlush is IPrizeFlush, Manageable { /** * @notice Destination address for captured interest. * @dev Should be set to the PrizeDistributor address. */ address internal destination; /// @notice Reserve address. IReserve internal reserve; /// @notice Strategy address. IStrategy internal strategy; /** * @notice Emitted when contract has been deployed. * @param destination Destination address * @param reserve Strategy address * @param strategy Reserve address * */ event Deployed( address indexed destination, IReserve indexed reserve, IStrategy indexed strategy ); /* ============ Constructor ============ */ /** * @notice Deploy Prize Flush. * @param _owner Prize Flush owner address * @param _destination Destination address * @param _strategy Strategy address * @param _reserve Reserve address * */ constructor( address _owner, address _destination, IStrategy _strategy, IReserve _reserve ) Ownable(_owner) { _setDestination(_destination); _setReserve(_reserve); _setStrategy(_strategy); emit Deployed(_destination, _reserve, _strategy); } /* ============ External Functions ============ */ /// @inheritdoc IPrizeFlush function getDestination() external view override returns (address) { return destination; } /// @inheritdoc IPrizeFlush function getReserve() external view override returns (IReserve) { return reserve; } /// @inheritdoc IPrizeFlush function getStrategy() external view override returns (IStrategy) { return strategy; } /// @inheritdoc IPrizeFlush function setDestination(address _destination) external override onlyOwner returns (address) { _setDestination(_destination); emit DestinationSet(_destination); return _destination; } /// @inheritdoc IPrizeFlush function setReserve(IReserve _reserve) external override onlyOwner returns (IReserve) { _setReserve(_reserve); emit ReserveSet(_reserve); return _reserve; } /// @inheritdoc IPrizeFlush function setStrategy(IStrategy _strategy) external override onlyOwner returns (IStrategy) { _setStrategy(_strategy); emit StrategySet(_strategy); return _strategy; } /// @inheritdoc IPrizeFlush function flush() external override onlyManagerOrOwner returns (bool) { // Captures interest from PrizePool and distributes funds using a PrizeSplitStrategy. strategy.distribute(); // After funds are distributed using PrizeSplitStrategy we EXPECT funds to be located in the Reserve. IReserve _reserve = reserve; IERC20 _token = _reserve.getToken(); uint256 _amount = _token.balanceOf(address(_reserve)); // IF the tokens were succesfully moved to the Reserve, now move them to the destination (PrizeDistributor) address. if (_amount > 0) { address _destination = destination; // Create checkpoint and transfers new total balance to PrizeDistributor _reserve.withdrawTo(_destination, _amount); emit Flushed(_destination, _amount); return true; } return false; } /* ============ Internal Functions ============ */ /** * @notice Set global destination variable. * @dev `_destination` cannot be the zero address. * @param _destination Destination address */ function _setDestination(address _destination) internal { require(_destination != address(0), "Flush/destination-not-zero-address"); destination = _destination; } /** * @notice Set global reserve variable. * @dev `_reserve` cannot be the zero address. * @param _reserve Reserve address */ function _setReserve(IReserve _reserve) internal { require(address(_reserve) != address(0), "Flush/reserve-not-zero-address"); reserve = _reserve; } /** * @notice Set global strategy variable. * @dev `_strategy` cannot be the zero address. * @param _strategy Strategy address */ function _setStrategy(IStrategy _strategy) internal { require(address(_strategy) != address(0), "Flush/strategy-not-zero-address"); strategy = _strategy; } }
/** * @title PoolTogether V4 PrizeFlush * @author PoolTogether Inc Team * @notice The PrizeFlush contract helps capture interest from the PrizePool and move collected funds to a designated PrizeDistributor contract. When deployed, the destination, reserve and strategy addresses are set and used as static parameters during every "flush" execution. The parameters can be reset by the Owner if necessary. */
NatSpecMultiLine
getReserve
function getReserve() external view override returns (IReserve) { return reserve; }
/// @inheritdoc IPrizeFlush
NatSpecSingleLine
v0.8.6+commit.11564f7e
GNU GPLv3
{ "func_code_index": [ 1515, 1614 ] }
5,757
PrizeFlush
@pooltogether/v4-periphery/contracts/PrizeFlush.sol
0x2193b28b2bdfbf805506c9d91ed2021ba6fbc888
Solidity
PrizeFlush
contract PrizeFlush is IPrizeFlush, Manageable { /** * @notice Destination address for captured interest. * @dev Should be set to the PrizeDistributor address. */ address internal destination; /// @notice Reserve address. IReserve internal reserve; /// @notice Strategy address. IStrategy internal strategy; /** * @notice Emitted when contract has been deployed. * @param destination Destination address * @param reserve Strategy address * @param strategy Reserve address * */ event Deployed( address indexed destination, IReserve indexed reserve, IStrategy indexed strategy ); /* ============ Constructor ============ */ /** * @notice Deploy Prize Flush. * @param _owner Prize Flush owner address * @param _destination Destination address * @param _strategy Strategy address * @param _reserve Reserve address * */ constructor( address _owner, address _destination, IStrategy _strategy, IReserve _reserve ) Ownable(_owner) { _setDestination(_destination); _setReserve(_reserve); _setStrategy(_strategy); emit Deployed(_destination, _reserve, _strategy); } /* ============ External Functions ============ */ /// @inheritdoc IPrizeFlush function getDestination() external view override returns (address) { return destination; } /// @inheritdoc IPrizeFlush function getReserve() external view override returns (IReserve) { return reserve; } /// @inheritdoc IPrizeFlush function getStrategy() external view override returns (IStrategy) { return strategy; } /// @inheritdoc IPrizeFlush function setDestination(address _destination) external override onlyOwner returns (address) { _setDestination(_destination); emit DestinationSet(_destination); return _destination; } /// @inheritdoc IPrizeFlush function setReserve(IReserve _reserve) external override onlyOwner returns (IReserve) { _setReserve(_reserve); emit ReserveSet(_reserve); return _reserve; } /// @inheritdoc IPrizeFlush function setStrategy(IStrategy _strategy) external override onlyOwner returns (IStrategy) { _setStrategy(_strategy); emit StrategySet(_strategy); return _strategy; } /// @inheritdoc IPrizeFlush function flush() external override onlyManagerOrOwner returns (bool) { // Captures interest from PrizePool and distributes funds using a PrizeSplitStrategy. strategy.distribute(); // After funds are distributed using PrizeSplitStrategy we EXPECT funds to be located in the Reserve. IReserve _reserve = reserve; IERC20 _token = _reserve.getToken(); uint256 _amount = _token.balanceOf(address(_reserve)); // IF the tokens were succesfully moved to the Reserve, now move them to the destination (PrizeDistributor) address. if (_amount > 0) { address _destination = destination; // Create checkpoint and transfers new total balance to PrizeDistributor _reserve.withdrawTo(_destination, _amount); emit Flushed(_destination, _amount); return true; } return false; } /* ============ Internal Functions ============ */ /** * @notice Set global destination variable. * @dev `_destination` cannot be the zero address. * @param _destination Destination address */ function _setDestination(address _destination) internal { require(_destination != address(0), "Flush/destination-not-zero-address"); destination = _destination; } /** * @notice Set global reserve variable. * @dev `_reserve` cannot be the zero address. * @param _reserve Reserve address */ function _setReserve(IReserve _reserve) internal { require(address(_reserve) != address(0), "Flush/reserve-not-zero-address"); reserve = _reserve; } /** * @notice Set global strategy variable. * @dev `_strategy` cannot be the zero address. * @param _strategy Strategy address */ function _setStrategy(IStrategy _strategy) internal { require(address(_strategy) != address(0), "Flush/strategy-not-zero-address"); strategy = _strategy; } }
/** * @title PoolTogether V4 PrizeFlush * @author PoolTogether Inc Team * @notice The PrizeFlush contract helps capture interest from the PrizePool and move collected funds to a designated PrizeDistributor contract. When deployed, the destination, reserve and strategy addresses are set and used as static parameters during every "flush" execution. The parameters can be reset by the Owner if necessary. */
NatSpecMultiLine
getStrategy
function getStrategy() external view override returns (IStrategy) { return strategy; }
/// @inheritdoc IPrizeFlush
NatSpecSingleLine
v0.8.6+commit.11564f7e
GNU GPLv3
{ "func_code_index": [ 1648, 1750 ] }
5,758
PrizeFlush
@pooltogether/v4-periphery/contracts/PrizeFlush.sol
0x2193b28b2bdfbf805506c9d91ed2021ba6fbc888
Solidity
PrizeFlush
contract PrizeFlush is IPrizeFlush, Manageable { /** * @notice Destination address for captured interest. * @dev Should be set to the PrizeDistributor address. */ address internal destination; /// @notice Reserve address. IReserve internal reserve; /// @notice Strategy address. IStrategy internal strategy; /** * @notice Emitted when contract has been deployed. * @param destination Destination address * @param reserve Strategy address * @param strategy Reserve address * */ event Deployed( address indexed destination, IReserve indexed reserve, IStrategy indexed strategy ); /* ============ Constructor ============ */ /** * @notice Deploy Prize Flush. * @param _owner Prize Flush owner address * @param _destination Destination address * @param _strategy Strategy address * @param _reserve Reserve address * */ constructor( address _owner, address _destination, IStrategy _strategy, IReserve _reserve ) Ownable(_owner) { _setDestination(_destination); _setReserve(_reserve); _setStrategy(_strategy); emit Deployed(_destination, _reserve, _strategy); } /* ============ External Functions ============ */ /// @inheritdoc IPrizeFlush function getDestination() external view override returns (address) { return destination; } /// @inheritdoc IPrizeFlush function getReserve() external view override returns (IReserve) { return reserve; } /// @inheritdoc IPrizeFlush function getStrategy() external view override returns (IStrategy) { return strategy; } /// @inheritdoc IPrizeFlush function setDestination(address _destination) external override onlyOwner returns (address) { _setDestination(_destination); emit DestinationSet(_destination); return _destination; } /// @inheritdoc IPrizeFlush function setReserve(IReserve _reserve) external override onlyOwner returns (IReserve) { _setReserve(_reserve); emit ReserveSet(_reserve); return _reserve; } /// @inheritdoc IPrizeFlush function setStrategy(IStrategy _strategy) external override onlyOwner returns (IStrategy) { _setStrategy(_strategy); emit StrategySet(_strategy); return _strategy; } /// @inheritdoc IPrizeFlush function flush() external override onlyManagerOrOwner returns (bool) { // Captures interest from PrizePool and distributes funds using a PrizeSplitStrategy. strategy.distribute(); // After funds are distributed using PrizeSplitStrategy we EXPECT funds to be located in the Reserve. IReserve _reserve = reserve; IERC20 _token = _reserve.getToken(); uint256 _amount = _token.balanceOf(address(_reserve)); // IF the tokens were succesfully moved to the Reserve, now move them to the destination (PrizeDistributor) address. if (_amount > 0) { address _destination = destination; // Create checkpoint and transfers new total balance to PrizeDistributor _reserve.withdrawTo(_destination, _amount); emit Flushed(_destination, _amount); return true; } return false; } /* ============ Internal Functions ============ */ /** * @notice Set global destination variable. * @dev `_destination` cannot be the zero address. * @param _destination Destination address */ function _setDestination(address _destination) internal { require(_destination != address(0), "Flush/destination-not-zero-address"); destination = _destination; } /** * @notice Set global reserve variable. * @dev `_reserve` cannot be the zero address. * @param _reserve Reserve address */ function _setReserve(IReserve _reserve) internal { require(address(_reserve) != address(0), "Flush/reserve-not-zero-address"); reserve = _reserve; } /** * @notice Set global strategy variable. * @dev `_strategy` cannot be the zero address. * @param _strategy Strategy address */ function _setStrategy(IStrategy _strategy) internal { require(address(_strategy) != address(0), "Flush/strategy-not-zero-address"); strategy = _strategy; } }
/** * @title PoolTogether V4 PrizeFlush * @author PoolTogether Inc Team * @notice The PrizeFlush contract helps capture interest from the PrizePool and move collected funds to a designated PrizeDistributor contract. When deployed, the destination, reserve and strategy addresses are set and used as static parameters during every "flush" execution. The parameters can be reset by the Owner if necessary. */
NatSpecMultiLine
setDestination
function setDestination(address _destination) external override onlyOwner returns (address) { _setDestination(_destination); emit DestinationSet(_destination); return _destination; }
/// @inheritdoc IPrizeFlush
NatSpecSingleLine
v0.8.6+commit.11564f7e
GNU GPLv3
{ "func_code_index": [ 1784, 1998 ] }
5,759
PrizeFlush
@pooltogether/v4-periphery/contracts/PrizeFlush.sol
0x2193b28b2bdfbf805506c9d91ed2021ba6fbc888
Solidity
PrizeFlush
contract PrizeFlush is IPrizeFlush, Manageable { /** * @notice Destination address for captured interest. * @dev Should be set to the PrizeDistributor address. */ address internal destination; /// @notice Reserve address. IReserve internal reserve; /// @notice Strategy address. IStrategy internal strategy; /** * @notice Emitted when contract has been deployed. * @param destination Destination address * @param reserve Strategy address * @param strategy Reserve address * */ event Deployed( address indexed destination, IReserve indexed reserve, IStrategy indexed strategy ); /* ============ Constructor ============ */ /** * @notice Deploy Prize Flush. * @param _owner Prize Flush owner address * @param _destination Destination address * @param _strategy Strategy address * @param _reserve Reserve address * */ constructor( address _owner, address _destination, IStrategy _strategy, IReserve _reserve ) Ownable(_owner) { _setDestination(_destination); _setReserve(_reserve); _setStrategy(_strategy); emit Deployed(_destination, _reserve, _strategy); } /* ============ External Functions ============ */ /// @inheritdoc IPrizeFlush function getDestination() external view override returns (address) { return destination; } /// @inheritdoc IPrizeFlush function getReserve() external view override returns (IReserve) { return reserve; } /// @inheritdoc IPrizeFlush function getStrategy() external view override returns (IStrategy) { return strategy; } /// @inheritdoc IPrizeFlush function setDestination(address _destination) external override onlyOwner returns (address) { _setDestination(_destination); emit DestinationSet(_destination); return _destination; } /// @inheritdoc IPrizeFlush function setReserve(IReserve _reserve) external override onlyOwner returns (IReserve) { _setReserve(_reserve); emit ReserveSet(_reserve); return _reserve; } /// @inheritdoc IPrizeFlush function setStrategy(IStrategy _strategy) external override onlyOwner returns (IStrategy) { _setStrategy(_strategy); emit StrategySet(_strategy); return _strategy; } /// @inheritdoc IPrizeFlush function flush() external override onlyManagerOrOwner returns (bool) { // Captures interest from PrizePool and distributes funds using a PrizeSplitStrategy. strategy.distribute(); // After funds are distributed using PrizeSplitStrategy we EXPECT funds to be located in the Reserve. IReserve _reserve = reserve; IERC20 _token = _reserve.getToken(); uint256 _amount = _token.balanceOf(address(_reserve)); // IF the tokens were succesfully moved to the Reserve, now move them to the destination (PrizeDistributor) address. if (_amount > 0) { address _destination = destination; // Create checkpoint and transfers new total balance to PrizeDistributor _reserve.withdrawTo(_destination, _amount); emit Flushed(_destination, _amount); return true; } return false; } /* ============ Internal Functions ============ */ /** * @notice Set global destination variable. * @dev `_destination` cannot be the zero address. * @param _destination Destination address */ function _setDestination(address _destination) internal { require(_destination != address(0), "Flush/destination-not-zero-address"); destination = _destination; } /** * @notice Set global reserve variable. * @dev `_reserve` cannot be the zero address. * @param _reserve Reserve address */ function _setReserve(IReserve _reserve) internal { require(address(_reserve) != address(0), "Flush/reserve-not-zero-address"); reserve = _reserve; } /** * @notice Set global strategy variable. * @dev `_strategy` cannot be the zero address. * @param _strategy Strategy address */ function _setStrategy(IStrategy _strategy) internal { require(address(_strategy) != address(0), "Flush/strategy-not-zero-address"); strategy = _strategy; } }
/** * @title PoolTogether V4 PrizeFlush * @author PoolTogether Inc Team * @notice The PrizeFlush contract helps capture interest from the PrizePool and move collected funds to a designated PrizeDistributor contract. When deployed, the destination, reserve and strategy addresses are set and used as static parameters during every "flush" execution. The parameters can be reset by the Owner if necessary. */
NatSpecMultiLine
setReserve
function setReserve(IReserve _reserve) external override onlyOwner returns (IReserve) { _setReserve(_reserve); emit ReserveSet(_reserve); return _reserve; }
/// @inheritdoc IPrizeFlush
NatSpecSingleLine
v0.8.6+commit.11564f7e
GNU GPLv3
{ "func_code_index": [ 2032, 2220 ] }
5,760
PrizeFlush
@pooltogether/v4-periphery/contracts/PrizeFlush.sol
0x2193b28b2bdfbf805506c9d91ed2021ba6fbc888
Solidity
PrizeFlush
contract PrizeFlush is IPrizeFlush, Manageable { /** * @notice Destination address for captured interest. * @dev Should be set to the PrizeDistributor address. */ address internal destination; /// @notice Reserve address. IReserve internal reserve; /// @notice Strategy address. IStrategy internal strategy; /** * @notice Emitted when contract has been deployed. * @param destination Destination address * @param reserve Strategy address * @param strategy Reserve address * */ event Deployed( address indexed destination, IReserve indexed reserve, IStrategy indexed strategy ); /* ============ Constructor ============ */ /** * @notice Deploy Prize Flush. * @param _owner Prize Flush owner address * @param _destination Destination address * @param _strategy Strategy address * @param _reserve Reserve address * */ constructor( address _owner, address _destination, IStrategy _strategy, IReserve _reserve ) Ownable(_owner) { _setDestination(_destination); _setReserve(_reserve); _setStrategy(_strategy); emit Deployed(_destination, _reserve, _strategy); } /* ============ External Functions ============ */ /// @inheritdoc IPrizeFlush function getDestination() external view override returns (address) { return destination; } /// @inheritdoc IPrizeFlush function getReserve() external view override returns (IReserve) { return reserve; } /// @inheritdoc IPrizeFlush function getStrategy() external view override returns (IStrategy) { return strategy; } /// @inheritdoc IPrizeFlush function setDestination(address _destination) external override onlyOwner returns (address) { _setDestination(_destination); emit DestinationSet(_destination); return _destination; } /// @inheritdoc IPrizeFlush function setReserve(IReserve _reserve) external override onlyOwner returns (IReserve) { _setReserve(_reserve); emit ReserveSet(_reserve); return _reserve; } /// @inheritdoc IPrizeFlush function setStrategy(IStrategy _strategy) external override onlyOwner returns (IStrategy) { _setStrategy(_strategy); emit StrategySet(_strategy); return _strategy; } /// @inheritdoc IPrizeFlush function flush() external override onlyManagerOrOwner returns (bool) { // Captures interest from PrizePool and distributes funds using a PrizeSplitStrategy. strategy.distribute(); // After funds are distributed using PrizeSplitStrategy we EXPECT funds to be located in the Reserve. IReserve _reserve = reserve; IERC20 _token = _reserve.getToken(); uint256 _amount = _token.balanceOf(address(_reserve)); // IF the tokens were succesfully moved to the Reserve, now move them to the destination (PrizeDistributor) address. if (_amount > 0) { address _destination = destination; // Create checkpoint and transfers new total balance to PrizeDistributor _reserve.withdrawTo(_destination, _amount); emit Flushed(_destination, _amount); return true; } return false; } /* ============ Internal Functions ============ */ /** * @notice Set global destination variable. * @dev `_destination` cannot be the zero address. * @param _destination Destination address */ function _setDestination(address _destination) internal { require(_destination != address(0), "Flush/destination-not-zero-address"); destination = _destination; } /** * @notice Set global reserve variable. * @dev `_reserve` cannot be the zero address. * @param _reserve Reserve address */ function _setReserve(IReserve _reserve) internal { require(address(_reserve) != address(0), "Flush/reserve-not-zero-address"); reserve = _reserve; } /** * @notice Set global strategy variable. * @dev `_strategy` cannot be the zero address. * @param _strategy Strategy address */ function _setStrategy(IStrategy _strategy) internal { require(address(_strategy) != address(0), "Flush/strategy-not-zero-address"); strategy = _strategy; } }
/** * @title PoolTogether V4 PrizeFlush * @author PoolTogether Inc Team * @notice The PrizeFlush contract helps capture interest from the PrizePool and move collected funds to a designated PrizeDistributor contract. When deployed, the destination, reserve and strategy addresses are set and used as static parameters during every "flush" execution. The parameters can be reset by the Owner if necessary. */
NatSpecMultiLine
setStrategy
function setStrategy(IStrategy _strategy) external override onlyOwner returns (IStrategy) { _setStrategy(_strategy); emit StrategySet(_strategy); return _strategy; }
/// @inheritdoc IPrizeFlush
NatSpecSingleLine
v0.8.6+commit.11564f7e
GNU GPLv3
{ "func_code_index": [ 2254, 2451 ] }
5,761
PrizeFlush
@pooltogether/v4-periphery/contracts/PrizeFlush.sol
0x2193b28b2bdfbf805506c9d91ed2021ba6fbc888
Solidity
PrizeFlush
contract PrizeFlush is IPrizeFlush, Manageable { /** * @notice Destination address for captured interest. * @dev Should be set to the PrizeDistributor address. */ address internal destination; /// @notice Reserve address. IReserve internal reserve; /// @notice Strategy address. IStrategy internal strategy; /** * @notice Emitted when contract has been deployed. * @param destination Destination address * @param reserve Strategy address * @param strategy Reserve address * */ event Deployed( address indexed destination, IReserve indexed reserve, IStrategy indexed strategy ); /* ============ Constructor ============ */ /** * @notice Deploy Prize Flush. * @param _owner Prize Flush owner address * @param _destination Destination address * @param _strategy Strategy address * @param _reserve Reserve address * */ constructor( address _owner, address _destination, IStrategy _strategy, IReserve _reserve ) Ownable(_owner) { _setDestination(_destination); _setReserve(_reserve); _setStrategy(_strategy); emit Deployed(_destination, _reserve, _strategy); } /* ============ External Functions ============ */ /// @inheritdoc IPrizeFlush function getDestination() external view override returns (address) { return destination; } /// @inheritdoc IPrizeFlush function getReserve() external view override returns (IReserve) { return reserve; } /// @inheritdoc IPrizeFlush function getStrategy() external view override returns (IStrategy) { return strategy; } /// @inheritdoc IPrizeFlush function setDestination(address _destination) external override onlyOwner returns (address) { _setDestination(_destination); emit DestinationSet(_destination); return _destination; } /// @inheritdoc IPrizeFlush function setReserve(IReserve _reserve) external override onlyOwner returns (IReserve) { _setReserve(_reserve); emit ReserveSet(_reserve); return _reserve; } /// @inheritdoc IPrizeFlush function setStrategy(IStrategy _strategy) external override onlyOwner returns (IStrategy) { _setStrategy(_strategy); emit StrategySet(_strategy); return _strategy; } /// @inheritdoc IPrizeFlush function flush() external override onlyManagerOrOwner returns (bool) { // Captures interest from PrizePool and distributes funds using a PrizeSplitStrategy. strategy.distribute(); // After funds are distributed using PrizeSplitStrategy we EXPECT funds to be located in the Reserve. IReserve _reserve = reserve; IERC20 _token = _reserve.getToken(); uint256 _amount = _token.balanceOf(address(_reserve)); // IF the tokens were succesfully moved to the Reserve, now move them to the destination (PrizeDistributor) address. if (_amount > 0) { address _destination = destination; // Create checkpoint and transfers new total balance to PrizeDistributor _reserve.withdrawTo(_destination, _amount); emit Flushed(_destination, _amount); return true; } return false; } /* ============ Internal Functions ============ */ /** * @notice Set global destination variable. * @dev `_destination` cannot be the zero address. * @param _destination Destination address */ function _setDestination(address _destination) internal { require(_destination != address(0), "Flush/destination-not-zero-address"); destination = _destination; } /** * @notice Set global reserve variable. * @dev `_reserve` cannot be the zero address. * @param _reserve Reserve address */ function _setReserve(IReserve _reserve) internal { require(address(_reserve) != address(0), "Flush/reserve-not-zero-address"); reserve = _reserve; } /** * @notice Set global strategy variable. * @dev `_strategy` cannot be the zero address. * @param _strategy Strategy address */ function _setStrategy(IStrategy _strategy) internal { require(address(_strategy) != address(0), "Flush/strategy-not-zero-address"); strategy = _strategy; } }
/** * @title PoolTogether V4 PrizeFlush * @author PoolTogether Inc Team * @notice The PrizeFlush contract helps capture interest from the PrizePool and move collected funds to a designated PrizeDistributor contract. When deployed, the destination, reserve and strategy addresses are set and used as static parameters during every "flush" execution. The parameters can be reset by the Owner if necessary. */
NatSpecMultiLine
flush
function flush() external override onlyManagerOrOwner returns (bool) { // Captures interest from PrizePool and distributes funds using a PrizeSplitStrategy. strategy.distribute(); // After funds are distributed using PrizeSplitStrategy we EXPECT funds to be located in the Reserve. IReserve _reserve = reserve; IERC20 _token = _reserve.getToken(); uint256 _amount = _token.balanceOf(address(_reserve)); // IF the tokens were succesfully moved to the Reserve, now move them to the destination (PrizeDistributor) address. if (_amount > 0) { address _destination = destination; // Create checkpoint and transfers new total balance to PrizeDistributor _reserve.withdrawTo(_destination, _amount); emit Flushed(_destination, _amount); return true; } return false; }
/// @inheritdoc IPrizeFlush
NatSpecSingleLine
v0.8.6+commit.11564f7e
GNU GPLv3
{ "func_code_index": [ 2485, 3397 ] }
5,762
PrizeFlush
@pooltogether/v4-periphery/contracts/PrizeFlush.sol
0x2193b28b2bdfbf805506c9d91ed2021ba6fbc888
Solidity
PrizeFlush
contract PrizeFlush is IPrizeFlush, Manageable { /** * @notice Destination address for captured interest. * @dev Should be set to the PrizeDistributor address. */ address internal destination; /// @notice Reserve address. IReserve internal reserve; /// @notice Strategy address. IStrategy internal strategy; /** * @notice Emitted when contract has been deployed. * @param destination Destination address * @param reserve Strategy address * @param strategy Reserve address * */ event Deployed( address indexed destination, IReserve indexed reserve, IStrategy indexed strategy ); /* ============ Constructor ============ */ /** * @notice Deploy Prize Flush. * @param _owner Prize Flush owner address * @param _destination Destination address * @param _strategy Strategy address * @param _reserve Reserve address * */ constructor( address _owner, address _destination, IStrategy _strategy, IReserve _reserve ) Ownable(_owner) { _setDestination(_destination); _setReserve(_reserve); _setStrategy(_strategy); emit Deployed(_destination, _reserve, _strategy); } /* ============ External Functions ============ */ /// @inheritdoc IPrizeFlush function getDestination() external view override returns (address) { return destination; } /// @inheritdoc IPrizeFlush function getReserve() external view override returns (IReserve) { return reserve; } /// @inheritdoc IPrizeFlush function getStrategy() external view override returns (IStrategy) { return strategy; } /// @inheritdoc IPrizeFlush function setDestination(address _destination) external override onlyOwner returns (address) { _setDestination(_destination); emit DestinationSet(_destination); return _destination; } /// @inheritdoc IPrizeFlush function setReserve(IReserve _reserve) external override onlyOwner returns (IReserve) { _setReserve(_reserve); emit ReserveSet(_reserve); return _reserve; } /// @inheritdoc IPrizeFlush function setStrategy(IStrategy _strategy) external override onlyOwner returns (IStrategy) { _setStrategy(_strategy); emit StrategySet(_strategy); return _strategy; } /// @inheritdoc IPrizeFlush function flush() external override onlyManagerOrOwner returns (bool) { // Captures interest from PrizePool and distributes funds using a PrizeSplitStrategy. strategy.distribute(); // After funds are distributed using PrizeSplitStrategy we EXPECT funds to be located in the Reserve. IReserve _reserve = reserve; IERC20 _token = _reserve.getToken(); uint256 _amount = _token.balanceOf(address(_reserve)); // IF the tokens were succesfully moved to the Reserve, now move them to the destination (PrizeDistributor) address. if (_amount > 0) { address _destination = destination; // Create checkpoint and transfers new total balance to PrizeDistributor _reserve.withdrawTo(_destination, _amount); emit Flushed(_destination, _amount); return true; } return false; } /* ============ Internal Functions ============ */ /** * @notice Set global destination variable. * @dev `_destination` cannot be the zero address. * @param _destination Destination address */ function _setDestination(address _destination) internal { require(_destination != address(0), "Flush/destination-not-zero-address"); destination = _destination; } /** * @notice Set global reserve variable. * @dev `_reserve` cannot be the zero address. * @param _reserve Reserve address */ function _setReserve(IReserve _reserve) internal { require(address(_reserve) != address(0), "Flush/reserve-not-zero-address"); reserve = _reserve; } /** * @notice Set global strategy variable. * @dev `_strategy` cannot be the zero address. * @param _strategy Strategy address */ function _setStrategy(IStrategy _strategy) internal { require(address(_strategy) != address(0), "Flush/strategy-not-zero-address"); strategy = _strategy; } }
/** * @title PoolTogether V4 PrizeFlush * @author PoolTogether Inc Team * @notice The PrizeFlush contract helps capture interest from the PrizePool and move collected funds to a designated PrizeDistributor contract. When deployed, the destination, reserve and strategy addresses are set and used as static parameters during every "flush" execution. The parameters can be reset by the Owner if necessary. */
NatSpecMultiLine
_setDestination
function _setDestination(address _destination) internal { require(_destination != address(0), "Flush/destination-not-zero-address"); destination = _destination; }
/** * @notice Set global destination variable. * @dev `_destination` cannot be the zero address. * @param _destination Destination address */
NatSpecMultiLine
v0.8.6+commit.11564f7e
GNU GPLv3
{ "func_code_index": [ 3621, 3807 ] }
5,763
PrizeFlush
@pooltogether/v4-periphery/contracts/PrizeFlush.sol
0x2193b28b2bdfbf805506c9d91ed2021ba6fbc888
Solidity
PrizeFlush
contract PrizeFlush is IPrizeFlush, Manageable { /** * @notice Destination address for captured interest. * @dev Should be set to the PrizeDistributor address. */ address internal destination; /// @notice Reserve address. IReserve internal reserve; /// @notice Strategy address. IStrategy internal strategy; /** * @notice Emitted when contract has been deployed. * @param destination Destination address * @param reserve Strategy address * @param strategy Reserve address * */ event Deployed( address indexed destination, IReserve indexed reserve, IStrategy indexed strategy ); /* ============ Constructor ============ */ /** * @notice Deploy Prize Flush. * @param _owner Prize Flush owner address * @param _destination Destination address * @param _strategy Strategy address * @param _reserve Reserve address * */ constructor( address _owner, address _destination, IStrategy _strategy, IReserve _reserve ) Ownable(_owner) { _setDestination(_destination); _setReserve(_reserve); _setStrategy(_strategy); emit Deployed(_destination, _reserve, _strategy); } /* ============ External Functions ============ */ /// @inheritdoc IPrizeFlush function getDestination() external view override returns (address) { return destination; } /// @inheritdoc IPrizeFlush function getReserve() external view override returns (IReserve) { return reserve; } /// @inheritdoc IPrizeFlush function getStrategy() external view override returns (IStrategy) { return strategy; } /// @inheritdoc IPrizeFlush function setDestination(address _destination) external override onlyOwner returns (address) { _setDestination(_destination); emit DestinationSet(_destination); return _destination; } /// @inheritdoc IPrizeFlush function setReserve(IReserve _reserve) external override onlyOwner returns (IReserve) { _setReserve(_reserve); emit ReserveSet(_reserve); return _reserve; } /// @inheritdoc IPrizeFlush function setStrategy(IStrategy _strategy) external override onlyOwner returns (IStrategy) { _setStrategy(_strategy); emit StrategySet(_strategy); return _strategy; } /// @inheritdoc IPrizeFlush function flush() external override onlyManagerOrOwner returns (bool) { // Captures interest from PrizePool and distributes funds using a PrizeSplitStrategy. strategy.distribute(); // After funds are distributed using PrizeSplitStrategy we EXPECT funds to be located in the Reserve. IReserve _reserve = reserve; IERC20 _token = _reserve.getToken(); uint256 _amount = _token.balanceOf(address(_reserve)); // IF the tokens were succesfully moved to the Reserve, now move them to the destination (PrizeDistributor) address. if (_amount > 0) { address _destination = destination; // Create checkpoint and transfers new total balance to PrizeDistributor _reserve.withdrawTo(_destination, _amount); emit Flushed(_destination, _amount); return true; } return false; } /* ============ Internal Functions ============ */ /** * @notice Set global destination variable. * @dev `_destination` cannot be the zero address. * @param _destination Destination address */ function _setDestination(address _destination) internal { require(_destination != address(0), "Flush/destination-not-zero-address"); destination = _destination; } /** * @notice Set global reserve variable. * @dev `_reserve` cannot be the zero address. * @param _reserve Reserve address */ function _setReserve(IReserve _reserve) internal { require(address(_reserve) != address(0), "Flush/reserve-not-zero-address"); reserve = _reserve; } /** * @notice Set global strategy variable. * @dev `_strategy` cannot be the zero address. * @param _strategy Strategy address */ function _setStrategy(IStrategy _strategy) internal { require(address(_strategy) != address(0), "Flush/strategy-not-zero-address"); strategy = _strategy; } }
/** * @title PoolTogether V4 PrizeFlush * @author PoolTogether Inc Team * @notice The PrizeFlush contract helps capture interest from the PrizePool and move collected funds to a designated PrizeDistributor contract. When deployed, the destination, reserve and strategy addresses are set and used as static parameters during every "flush" execution. The parameters can be reset by the Owner if necessary. */
NatSpecMultiLine
_setReserve
function _setReserve(IReserve _reserve) internal { require(address(_reserve) != address(0), "Flush/reserve-not-zero-address"); reserve = _reserve; }
/** * @notice Set global reserve variable. * @dev `_reserve` cannot be the zero address. * @param _reserve Reserve address */
NatSpecMultiLine
v0.8.6+commit.11564f7e
GNU GPLv3
{ "func_code_index": [ 3959, 4131 ] }
5,764
PrizeFlush
@pooltogether/v4-periphery/contracts/PrizeFlush.sol
0x2193b28b2bdfbf805506c9d91ed2021ba6fbc888
Solidity
PrizeFlush
contract PrizeFlush is IPrizeFlush, Manageable { /** * @notice Destination address for captured interest. * @dev Should be set to the PrizeDistributor address. */ address internal destination; /// @notice Reserve address. IReserve internal reserve; /// @notice Strategy address. IStrategy internal strategy; /** * @notice Emitted when contract has been deployed. * @param destination Destination address * @param reserve Strategy address * @param strategy Reserve address * */ event Deployed( address indexed destination, IReserve indexed reserve, IStrategy indexed strategy ); /* ============ Constructor ============ */ /** * @notice Deploy Prize Flush. * @param _owner Prize Flush owner address * @param _destination Destination address * @param _strategy Strategy address * @param _reserve Reserve address * */ constructor( address _owner, address _destination, IStrategy _strategy, IReserve _reserve ) Ownable(_owner) { _setDestination(_destination); _setReserve(_reserve); _setStrategy(_strategy); emit Deployed(_destination, _reserve, _strategy); } /* ============ External Functions ============ */ /// @inheritdoc IPrizeFlush function getDestination() external view override returns (address) { return destination; } /// @inheritdoc IPrizeFlush function getReserve() external view override returns (IReserve) { return reserve; } /// @inheritdoc IPrizeFlush function getStrategy() external view override returns (IStrategy) { return strategy; } /// @inheritdoc IPrizeFlush function setDestination(address _destination) external override onlyOwner returns (address) { _setDestination(_destination); emit DestinationSet(_destination); return _destination; } /// @inheritdoc IPrizeFlush function setReserve(IReserve _reserve) external override onlyOwner returns (IReserve) { _setReserve(_reserve); emit ReserveSet(_reserve); return _reserve; } /// @inheritdoc IPrizeFlush function setStrategy(IStrategy _strategy) external override onlyOwner returns (IStrategy) { _setStrategy(_strategy); emit StrategySet(_strategy); return _strategy; } /// @inheritdoc IPrizeFlush function flush() external override onlyManagerOrOwner returns (bool) { // Captures interest from PrizePool and distributes funds using a PrizeSplitStrategy. strategy.distribute(); // After funds are distributed using PrizeSplitStrategy we EXPECT funds to be located in the Reserve. IReserve _reserve = reserve; IERC20 _token = _reserve.getToken(); uint256 _amount = _token.balanceOf(address(_reserve)); // IF the tokens were succesfully moved to the Reserve, now move them to the destination (PrizeDistributor) address. if (_amount > 0) { address _destination = destination; // Create checkpoint and transfers new total balance to PrizeDistributor _reserve.withdrawTo(_destination, _amount); emit Flushed(_destination, _amount); return true; } return false; } /* ============ Internal Functions ============ */ /** * @notice Set global destination variable. * @dev `_destination` cannot be the zero address. * @param _destination Destination address */ function _setDestination(address _destination) internal { require(_destination != address(0), "Flush/destination-not-zero-address"); destination = _destination; } /** * @notice Set global reserve variable. * @dev `_reserve` cannot be the zero address. * @param _reserve Reserve address */ function _setReserve(IReserve _reserve) internal { require(address(_reserve) != address(0), "Flush/reserve-not-zero-address"); reserve = _reserve; } /** * @notice Set global strategy variable. * @dev `_strategy` cannot be the zero address. * @param _strategy Strategy address */ function _setStrategy(IStrategy _strategy) internal { require(address(_strategy) != address(0), "Flush/strategy-not-zero-address"); strategy = _strategy; } }
/** * @title PoolTogether V4 PrizeFlush * @author PoolTogether Inc Team * @notice The PrizeFlush contract helps capture interest from the PrizePool and move collected funds to a designated PrizeDistributor contract. When deployed, the destination, reserve and strategy addresses are set and used as static parameters during every "flush" execution. The parameters can be reset by the Owner if necessary. */
NatSpecMultiLine
_setStrategy
function _setStrategy(IStrategy _strategy) internal { require(address(_strategy) != address(0), "Flush/strategy-not-zero-address"); strategy = _strategy; }
/** * @notice Set global strategy variable. * @dev `_strategy` cannot be the zero address. * @param _strategy Strategy address */
NatSpecMultiLine
v0.8.6+commit.11564f7e
GNU GPLv3
{ "func_code_index": [ 4287, 4466 ] }
5,765
RenAssetProxyBeacon
src/GatewayRegistry/ProxyBeacon.sol
0x521c99aeaa60a46fad6c589f7c2e0f93667ea8c6
Solidity
ProxyBeacon
contract ProxyBeacon is Context, UpgradeableBeacon { event LogProxyDeployerUpdated(address indexed oldProxyDeployer, address indexed newProxyDeployer); // Only allow one address to call `deployProxy`. address private _proxyDeployer; modifier onlyProxyDeployer() { address proxyDeployer_ = getProxyDeployer(); require( proxyDeployer_ != address(0x0) && _msgSender() == proxyDeployer_, "ProxyBeacon: caller is not the proxy deployer" ); _; } constructor(address implementation_, address contractOwner) UpgradeableBeacon(implementation_) { transferOwnership(contractOwner); } // GETTERS ///////////////////////////////////////////////////////////////// function getProxyDeployer() public view returns (address) { return _proxyDeployer; } // GOVERNANCE ////////////////////////////////////////////////////////////// function updateProxyDeployer(address newProxyDeployer) public onlyOwner { require(newProxyDeployer != address(0x0), "ProxyBeacon: invalid proxy deployer"); address oldProxyDeployer = _proxyDeployer; _proxyDeployer = newProxyDeployer; emit LogProxyDeployerUpdated(oldProxyDeployer, newProxyDeployer); } // RESTRICTED ////////////////////////////////////////////////////////////// /// @notice Deploy a proxy that fetches its implementation from this /// ProxyBeacon. function deployProxy(bytes32 create2Salt, bytes calldata encodedParameters) external onlyProxyDeployer returns (address) { // Deploy without initialization code so that the create2 address isn't // based on the initialization parameters. address proxy = address(new BeaconProxy{salt: create2Salt}(address(this), "")); Address.functionCall(address(proxy), encodedParameters); return proxy; } }
getProxyDeployer
function getProxyDeployer() public view returns (address) { return _proxyDeployer; }
// GETTERS /////////////////////////////////////////////////////////////////
LineComment
v0.8.7+commit.e28d00a7
GNU GPLv3
{ "func_code_index": [ 751, 851 ] }
5,766
RenAssetProxyBeacon
src/GatewayRegistry/ProxyBeacon.sol
0x521c99aeaa60a46fad6c589f7c2e0f93667ea8c6
Solidity
ProxyBeacon
contract ProxyBeacon is Context, UpgradeableBeacon { event LogProxyDeployerUpdated(address indexed oldProxyDeployer, address indexed newProxyDeployer); // Only allow one address to call `deployProxy`. address private _proxyDeployer; modifier onlyProxyDeployer() { address proxyDeployer_ = getProxyDeployer(); require( proxyDeployer_ != address(0x0) && _msgSender() == proxyDeployer_, "ProxyBeacon: caller is not the proxy deployer" ); _; } constructor(address implementation_, address contractOwner) UpgradeableBeacon(implementation_) { transferOwnership(contractOwner); } // GETTERS ///////////////////////////////////////////////////////////////// function getProxyDeployer() public view returns (address) { return _proxyDeployer; } // GOVERNANCE ////////////////////////////////////////////////////////////// function updateProxyDeployer(address newProxyDeployer) public onlyOwner { require(newProxyDeployer != address(0x0), "ProxyBeacon: invalid proxy deployer"); address oldProxyDeployer = _proxyDeployer; _proxyDeployer = newProxyDeployer; emit LogProxyDeployerUpdated(oldProxyDeployer, newProxyDeployer); } // RESTRICTED ////////////////////////////////////////////////////////////// /// @notice Deploy a proxy that fetches its implementation from this /// ProxyBeacon. function deployProxy(bytes32 create2Salt, bytes calldata encodedParameters) external onlyProxyDeployer returns (address) { // Deploy without initialization code so that the create2 address isn't // based on the initialization parameters. address proxy = address(new BeaconProxy{salt: create2Salt}(address(this), "")); Address.functionCall(address(proxy), encodedParameters); return proxy; } }
updateProxyDeployer
function updateProxyDeployer(address newProxyDeployer) public onlyOwner { require(newProxyDeployer != address(0x0), "ProxyBeacon: invalid proxy deployer"); address oldProxyDeployer = _proxyDeployer; _proxyDeployer = newProxyDeployer; emit LogProxyDeployerUpdated(oldProxyDeployer, newProxyDeployer); }
// GOVERNANCE //////////////////////////////////////////////////////////////
LineComment
v0.8.7+commit.e28d00a7
GNU GPLv3
{ "func_code_index": [ 935, 1276 ] }
5,767
RenAssetProxyBeacon
src/GatewayRegistry/ProxyBeacon.sol
0x521c99aeaa60a46fad6c589f7c2e0f93667ea8c6
Solidity
ProxyBeacon
contract ProxyBeacon is Context, UpgradeableBeacon { event LogProxyDeployerUpdated(address indexed oldProxyDeployer, address indexed newProxyDeployer); // Only allow one address to call `deployProxy`. address private _proxyDeployer; modifier onlyProxyDeployer() { address proxyDeployer_ = getProxyDeployer(); require( proxyDeployer_ != address(0x0) && _msgSender() == proxyDeployer_, "ProxyBeacon: caller is not the proxy deployer" ); _; } constructor(address implementation_, address contractOwner) UpgradeableBeacon(implementation_) { transferOwnership(contractOwner); } // GETTERS ///////////////////////////////////////////////////////////////// function getProxyDeployer() public view returns (address) { return _proxyDeployer; } // GOVERNANCE ////////////////////////////////////////////////////////////// function updateProxyDeployer(address newProxyDeployer) public onlyOwner { require(newProxyDeployer != address(0x0), "ProxyBeacon: invalid proxy deployer"); address oldProxyDeployer = _proxyDeployer; _proxyDeployer = newProxyDeployer; emit LogProxyDeployerUpdated(oldProxyDeployer, newProxyDeployer); } // RESTRICTED ////////////////////////////////////////////////////////////// /// @notice Deploy a proxy that fetches its implementation from this /// ProxyBeacon. function deployProxy(bytes32 create2Salt, bytes calldata encodedParameters) external onlyProxyDeployer returns (address) { // Deploy without initialization code so that the create2 address isn't // based on the initialization parameters. address proxy = address(new BeaconProxy{salt: create2Salt}(address(this), "")); Address.functionCall(address(proxy), encodedParameters); return proxy; } }
deployProxy
function deployProxy(bytes32 create2Salt, bytes calldata encodedParameters) external onlyProxyDeployer returns (address) { // Deploy without initialization code so that the create2 address isn't // based on the initialization parameters. address proxy = address(new BeaconProxy{salt: create2Salt}(address(this), "")); Address.functionCall(address(proxy), encodedParameters); return proxy; }
/// @notice Deploy a proxy that fetches its implementation from this /// ProxyBeacon.
NatSpecSingleLine
v0.8.7+commit.e28d00a7
GNU GPLv3
{ "func_code_index": [ 1454, 1923 ] }
5,768
HodlerInvestmentClub
HodlerInvestmentClub.sol
0x7bd52bdff0acf4e18dd80c6ee86db205d83f88ce
Solidity
HodlerInvestmentClub
contract HodlerInvestmentClub { uint public hodl_interval= 1 years; uint public m_hodlers = 1; struct Hodler { uint value; uint time; } mapping(address => Hodler) public hodlers; modifier onlyHodler { require(hodlers[msg.sender].value > 0); _; } /* Constructor */ function HodlerInvestmentClub() payable public { if (msg.value > 0) { hodlers[msg.sender].value = msg.value; hodlers[msg.sender].time = now + hodl_interval; } } // join the club! // make a deposit to another account if it exists // or initialize a deposit for a new account function deposit(address _to) payable public { require(msg.value > 0); if (_to == 0) _to = msg.sender; // if a new member, init a hodl time if (hodlers[_to].time == 0) { hodlers[_to].time = now + hodl_interval; m_hodlers++; } hodlers[_to].value += msg.value; } // withdrawal can only occur after deposit time is exceeded function withdraw() public onlyHodler { require(hodlers[msg.sender].time <= now); uint256 value = hodlers[msg.sender].value; delete hodlers[msg.sender]; m_hodlers--; require(msg.sender.send(value)); } // join the club! // simple deposit and hold time set for msg.sender function() payable public { require(msg.value > 0); hodlers[msg.sender].value += msg.value; // init for first deposit if (hodlers[msg.sender].time == 0) { hodlers[msg.sender].time = now + hodl_interval; m_hodlers++; } } }
/** * Holds funds for a year. Send to or deposit directly to this contract. * Each new acccount is initialized with a 1 year hold period, and is only * retrievable from the designated address after the set hold time. */
NatSpecMultiLine
HodlerInvestmentClub
function HodlerInvestmentClub() payable public { if (msg.value > 0) { hodlers[msg.sender].value = msg.value; hodlers[msg.sender].time = now + hodl_interval; } }
/* Constructor */
Comment
v0.4.18+commit.9cf6e910
bzzr://7e489af849d6d3d4ecd951f2f8e1f92869823252817154df6b1a81d51039b1cb
{ "func_code_index": [ 365, 580 ] }
5,769
HodlerInvestmentClub
HodlerInvestmentClub.sol
0x7bd52bdff0acf4e18dd80c6ee86db205d83f88ce
Solidity
HodlerInvestmentClub
contract HodlerInvestmentClub { uint public hodl_interval= 1 years; uint public m_hodlers = 1; struct Hodler { uint value; uint time; } mapping(address => Hodler) public hodlers; modifier onlyHodler { require(hodlers[msg.sender].value > 0); _; } /* Constructor */ function HodlerInvestmentClub() payable public { if (msg.value > 0) { hodlers[msg.sender].value = msg.value; hodlers[msg.sender].time = now + hodl_interval; } } // join the club! // make a deposit to another account if it exists // or initialize a deposit for a new account function deposit(address _to) payable public { require(msg.value > 0); if (_to == 0) _to = msg.sender; // if a new member, init a hodl time if (hodlers[_to].time == 0) { hodlers[_to].time = now + hodl_interval; m_hodlers++; } hodlers[_to].value += msg.value; } // withdrawal can only occur after deposit time is exceeded function withdraw() public onlyHodler { require(hodlers[msg.sender].time <= now); uint256 value = hodlers[msg.sender].value; delete hodlers[msg.sender]; m_hodlers--; require(msg.sender.send(value)); } // join the club! // simple deposit and hold time set for msg.sender function() payable public { require(msg.value > 0); hodlers[msg.sender].value += msg.value; // init for first deposit if (hodlers[msg.sender].time == 0) { hodlers[msg.sender].time = now + hodl_interval; m_hodlers++; } } }
/** * Holds funds for a year. Send to or deposit directly to this contract. * Each new acccount is initialized with a 1 year hold period, and is only * retrievable from the designated address after the set hold time. */
NatSpecMultiLine
deposit
function deposit(address _to) payable public { require(msg.value > 0); if (_to == 0) _to = msg.sender; // if a new member, init a hodl time if (hodlers[_to].time == 0) { hodlers[_to].time = now + hodl_interval; m_hodlers++; } hodlers[_to].value += msg.value; }
// join the club! // make a deposit to another account if it exists // or initialize a deposit for a new account
LineComment
v0.4.18+commit.9cf6e910
bzzr://7e489af849d6d3d4ecd951f2f8e1f92869823252817154df6b1a81d51039b1cb
{ "func_code_index": [ 716, 1067 ] }
5,770
HodlerInvestmentClub
HodlerInvestmentClub.sol
0x7bd52bdff0acf4e18dd80c6ee86db205d83f88ce
Solidity
HodlerInvestmentClub
contract HodlerInvestmentClub { uint public hodl_interval= 1 years; uint public m_hodlers = 1; struct Hodler { uint value; uint time; } mapping(address => Hodler) public hodlers; modifier onlyHodler { require(hodlers[msg.sender].value > 0); _; } /* Constructor */ function HodlerInvestmentClub() payable public { if (msg.value > 0) { hodlers[msg.sender].value = msg.value; hodlers[msg.sender].time = now + hodl_interval; } } // join the club! // make a deposit to another account if it exists // or initialize a deposit for a new account function deposit(address _to) payable public { require(msg.value > 0); if (_to == 0) _to = msg.sender; // if a new member, init a hodl time if (hodlers[_to].time == 0) { hodlers[_to].time = now + hodl_interval; m_hodlers++; } hodlers[_to].value += msg.value; } // withdrawal can only occur after deposit time is exceeded function withdraw() public onlyHodler { require(hodlers[msg.sender].time <= now); uint256 value = hodlers[msg.sender].value; delete hodlers[msg.sender]; m_hodlers--; require(msg.sender.send(value)); } // join the club! // simple deposit and hold time set for msg.sender function() payable public { require(msg.value > 0); hodlers[msg.sender].value += msg.value; // init for first deposit if (hodlers[msg.sender].time == 0) { hodlers[msg.sender].time = now + hodl_interval; m_hodlers++; } } }
/** * Holds funds for a year. Send to or deposit directly to this contract. * Each new acccount is initialized with a 1 year hold period, and is only * retrievable from the designated address after the set hold time. */
NatSpecMultiLine
withdraw
function withdraw() public onlyHodler { require(hodlers[msg.sender].time <= now); uint256 value = hodlers[msg.sender].value; delete hodlers[msg.sender]; m_hodlers--; require(msg.sender.send(value)); }
// withdrawal can only occur after deposit time is exceeded
LineComment
v0.4.18+commit.9cf6e910
bzzr://7e489af849d6d3d4ecd951f2f8e1f92869823252817154df6b1a81d51039b1cb
{ "func_code_index": [ 1139, 1394 ] }
5,771
HodlerInvestmentClub
HodlerInvestmentClub.sol
0x7bd52bdff0acf4e18dd80c6ee86db205d83f88ce
Solidity
HodlerInvestmentClub
contract HodlerInvestmentClub { uint public hodl_interval= 1 years; uint public m_hodlers = 1; struct Hodler { uint value; uint time; } mapping(address => Hodler) public hodlers; modifier onlyHodler { require(hodlers[msg.sender].value > 0); _; } /* Constructor */ function HodlerInvestmentClub() payable public { if (msg.value > 0) { hodlers[msg.sender].value = msg.value; hodlers[msg.sender].time = now + hodl_interval; } } // join the club! // make a deposit to another account if it exists // or initialize a deposit for a new account function deposit(address _to) payable public { require(msg.value > 0); if (_to == 0) _to = msg.sender; // if a new member, init a hodl time if (hodlers[_to].time == 0) { hodlers[_to].time = now + hodl_interval; m_hodlers++; } hodlers[_to].value += msg.value; } // withdrawal can only occur after deposit time is exceeded function withdraw() public onlyHodler { require(hodlers[msg.sender].time <= now); uint256 value = hodlers[msg.sender].value; delete hodlers[msg.sender]; m_hodlers--; require(msg.sender.send(value)); } // join the club! // simple deposit and hold time set for msg.sender function() payable public { require(msg.value > 0); hodlers[msg.sender].value += msg.value; // init for first deposit if (hodlers[msg.sender].time == 0) { hodlers[msg.sender].time = now + hodl_interval; m_hodlers++; } } }
/** * Holds funds for a year. Send to or deposit directly to this contract. * Each new acccount is initialized with a 1 year hold period, and is only * retrievable from the designated address after the set hold time. */
NatSpecMultiLine
function() payable public { require(msg.value > 0); hodlers[msg.sender].value += msg.value; // init for first deposit if (hodlers[msg.sender].time == 0) { hodlers[msg.sender].time = now + hodl_interval; m_hodlers++; } }
// join the club! // simple deposit and hold time set for msg.sender
LineComment
v0.4.18+commit.9cf6e910
bzzr://7e489af849d6d3d4ecd951f2f8e1f92869823252817154df6b1a81d51039b1cb
{ "func_code_index": [ 1480, 1780 ] }
5,772
FlashLiquidator
contracts/FlashLiquidator.sol
0x23d85060f87218bb276afe55a26bfd3b5f59914e
Solidity
FlashLiquidator
contract FlashLiquidator is IUniswapV3FlashCallback, PeripheryImmutableState, PeripheryPayments { using TransferHelper for address; ISwapRouter public immutable swapRouter; ICauldron public immutable cauldron; IWitch public immutable witch; address public immutable recipient; struct FlashCallbackData { bytes12 vaultId; address base; address collateral; uint256 baseLoan; address baseJoin; PoolAddress.PoolKey poolKey; } constructor( address _recipient, ISwapRouter _swapRouter, address _factory, address _WETH9, IWitch _witch ) PeripheryImmutableState(_factory, _WETH9) { swapRouter = _swapRouter; witch = _witch; cauldron = _witch.cauldron(); recipient = _recipient; } function collateralToDebtRatio(bytes12 vaultId) public returns (uint256) { DataTypes.Vault memory vault = cauldron.vaults(vaultId); DataTypes.Balances memory balances = cauldron.balances(vaultId); DataTypes.Series memory series = cauldron.series(vault.seriesId); if (balances.art == 0) { return 0; } // The castings below can't overflow int256 accruedDebt = int256(uint256(cauldron.debtToBase(vault.seriesId, balances.art))); int256 level = cauldron.level(vaultId); int256 ratio = int256(uint256((cauldron.spotOracles(series.baseId, vault.ilkId)).ratio)) * 1e12; // Convert from 6 to 18 decimals level = (level * 1e18) / (accruedDebt * ratio); require(level >= 0, "level is negative"); return uint256(level); } function isAtMinimalPrice(bytes12 vaultId) public returns (bool) { bytes6 ilkId = (cauldron.vaults(vaultId)).ilkId; (uint32 duration, ) = witch.ilks(ilkId); (, uint32 auctionStart) = witch.auctions(vaultId); uint256 elapsed = uint32(block.timestamp) - auctionStart; return elapsed >= duration; } /// @param fee0 The fee from calling flash for token0 /// @param fee1 The fee from calling flash for token1 /// @param data The data needed in the callback passed as FlashCallbackData from `initFlash` /// @notice implements the callback called from flash function uniswapV3FlashCallback( uint256 fee0, uint256 fee1, bytes calldata data ) external override { // we only borrow 1 token require(fee0 == 0 || fee1 == 0, "Two tokens were borrowed"); uint256 fee = fee0 + fee1; // decode and verify FlashCallbackData memory decoded = abi.decode(data, (FlashCallbackData)); CallbackValidation.verifyCallback(factory, decoded.poolKey); // liquidate the vault decoded.base.safeApprove(decoded.baseJoin, decoded.baseLoan); uint256 collateralReceived = witch.payAll(decoded.vaultId, 0); // sell the collateral uint256 debtToReturn = decoded.baseLoan + fee; decoded.collateral.safeApprove(address(swapRouter), collateralReceived); uint256 debtRecovered = swapRouter.exactInputSingle( ISwapRouter.ExactInputSingleParams({ tokenIn: decoded.collateral, tokenOut: decoded.base, fee: 500, // can't use the same fee as the flash loan // because of reentrancy protection recipient: address(this), deadline: block.timestamp + 180, amountIn: collateralReceived, amountOutMinimum: debtToReturn, sqrtPriceLimitX96: 0 }) ); // if profitable pay profits to recipient if (debtRecovered > debtToReturn) { uint256 profit = debtRecovered - debtToReturn; decoded.base.safeApprove(address(this), profit); pay(decoded.base, address(this), recipient, profit); } // repay flash loan decoded.base.safeApprove(address(this), debtToReturn); // TODO: Does this do anything? pay(decoded.base, address(this), msg.sender, debtToReturn); } /// @param vaultId The vault to liquidate /// @notice Liquidates a vault with help from a Uniswap v3 flash loan function liquidate(bytes12 vaultId) external { uint24 poolFee = 3000; // 0.3% DataTypes.Vault memory vault = cauldron.vaults(vaultId); DataTypes.Balances memory balances = cauldron.balances(vaultId); DataTypes.Series memory series = cauldron.series(vault.seriesId); address base = cauldron.assets(series.baseId); address collateral = cauldron.assets(vault.ilkId); uint128 baseLoan = cauldron.debtToBase(vault.seriesId, balances.art); // tokens in PoolKey must be ordered bool ordered = (collateral < base); PoolAddress.PoolKey memory poolKey = PoolAddress.PoolKey({ token0: ordered ? collateral : base, token1: ordered ? base : collateral, fee: poolFee }); IUniswapV3Pool pool = IUniswapV3Pool(PoolAddress.computeAddress(factory, poolKey)); // data for the callback to know what to do FlashCallbackData memory args = FlashCallbackData({ vaultId: vaultId, base: base, collateral: collateral, baseLoan: baseLoan, baseJoin: address(witch.ladle().joins(series.baseId)), poolKey: poolKey }); // initiate flash loan, with the liquidation logic embedded in the flash loan callback pool.flash( address(this), ordered ? 0 : baseLoan, ordered ? baseLoan : 0, abi.encode( args ) ); } }
uniswapV3FlashCallback
function uniswapV3FlashCallback( uint256 fee0, uint256 fee1, bytes calldata data ) external override { // we only borrow 1 token require(fee0 == 0 || fee1 == 0, "Two tokens were borrowed"); uint256 fee = fee0 + fee1; // decode and verify FlashCallbackData memory decoded = abi.decode(data, (FlashCallbackData)); CallbackValidation.verifyCallback(factory, decoded.poolKey); // liquidate the vault decoded.base.safeApprove(decoded.baseJoin, decoded.baseLoan); uint256 collateralReceived = witch.payAll(decoded.vaultId, 0); // sell the collateral uint256 debtToReturn = decoded.baseLoan + fee; decoded.collateral.safeApprove(address(swapRouter), collateralReceived); uint256 debtRecovered = swapRouter.exactInputSingle( ISwapRouter.ExactInputSingleParams({ tokenIn: decoded.collateral, tokenOut: decoded.base, fee: 500, // can't use the same fee as the flash loan // because of reentrancy protection recipient: address(this), deadline: block.timestamp + 180, amountIn: collateralReceived, amountOutMinimum: debtToReturn, sqrtPriceLimitX96: 0 }) ); // if profitable pay profits to recipient if (debtRecovered > debtToReturn) { uint256 profit = debtRecovered - debtToReturn; decoded.base.safeApprove(address(this), profit); pay(decoded.base, address(this), recipient, profit); } // repay flash loan decoded.base.safeApprove(address(this), debtToReturn); // TODO: Does this do anything? pay(decoded.base, address(this), msg.sender, debtToReturn); }
/// @param fee0 The fee from calling flash for token0 /// @param fee1 The fee from calling flash for token1 /// @param data The data needed in the callback passed as FlashCallbackData from `initFlash` /// @notice implements the callback called from flash
NatSpecSingleLine
v0.8.6+commit.11564f7e
{ "func_code_index": [ 2287, 4151 ] }
5,773
FlashLiquidator
contracts/FlashLiquidator.sol
0x23d85060f87218bb276afe55a26bfd3b5f59914e
Solidity
FlashLiquidator
contract FlashLiquidator is IUniswapV3FlashCallback, PeripheryImmutableState, PeripheryPayments { using TransferHelper for address; ISwapRouter public immutable swapRouter; ICauldron public immutable cauldron; IWitch public immutable witch; address public immutable recipient; struct FlashCallbackData { bytes12 vaultId; address base; address collateral; uint256 baseLoan; address baseJoin; PoolAddress.PoolKey poolKey; } constructor( address _recipient, ISwapRouter _swapRouter, address _factory, address _WETH9, IWitch _witch ) PeripheryImmutableState(_factory, _WETH9) { swapRouter = _swapRouter; witch = _witch; cauldron = _witch.cauldron(); recipient = _recipient; } function collateralToDebtRatio(bytes12 vaultId) public returns (uint256) { DataTypes.Vault memory vault = cauldron.vaults(vaultId); DataTypes.Balances memory balances = cauldron.balances(vaultId); DataTypes.Series memory series = cauldron.series(vault.seriesId); if (balances.art == 0) { return 0; } // The castings below can't overflow int256 accruedDebt = int256(uint256(cauldron.debtToBase(vault.seriesId, balances.art))); int256 level = cauldron.level(vaultId); int256 ratio = int256(uint256((cauldron.spotOracles(series.baseId, vault.ilkId)).ratio)) * 1e12; // Convert from 6 to 18 decimals level = (level * 1e18) / (accruedDebt * ratio); require(level >= 0, "level is negative"); return uint256(level); } function isAtMinimalPrice(bytes12 vaultId) public returns (bool) { bytes6 ilkId = (cauldron.vaults(vaultId)).ilkId; (uint32 duration, ) = witch.ilks(ilkId); (, uint32 auctionStart) = witch.auctions(vaultId); uint256 elapsed = uint32(block.timestamp) - auctionStart; return elapsed >= duration; } /// @param fee0 The fee from calling flash for token0 /// @param fee1 The fee from calling flash for token1 /// @param data The data needed in the callback passed as FlashCallbackData from `initFlash` /// @notice implements the callback called from flash function uniswapV3FlashCallback( uint256 fee0, uint256 fee1, bytes calldata data ) external override { // we only borrow 1 token require(fee0 == 0 || fee1 == 0, "Two tokens were borrowed"); uint256 fee = fee0 + fee1; // decode and verify FlashCallbackData memory decoded = abi.decode(data, (FlashCallbackData)); CallbackValidation.verifyCallback(factory, decoded.poolKey); // liquidate the vault decoded.base.safeApprove(decoded.baseJoin, decoded.baseLoan); uint256 collateralReceived = witch.payAll(decoded.vaultId, 0); // sell the collateral uint256 debtToReturn = decoded.baseLoan + fee; decoded.collateral.safeApprove(address(swapRouter), collateralReceived); uint256 debtRecovered = swapRouter.exactInputSingle( ISwapRouter.ExactInputSingleParams({ tokenIn: decoded.collateral, tokenOut: decoded.base, fee: 500, // can't use the same fee as the flash loan // because of reentrancy protection recipient: address(this), deadline: block.timestamp + 180, amountIn: collateralReceived, amountOutMinimum: debtToReturn, sqrtPriceLimitX96: 0 }) ); // if profitable pay profits to recipient if (debtRecovered > debtToReturn) { uint256 profit = debtRecovered - debtToReturn; decoded.base.safeApprove(address(this), profit); pay(decoded.base, address(this), recipient, profit); } // repay flash loan decoded.base.safeApprove(address(this), debtToReturn); // TODO: Does this do anything? pay(decoded.base, address(this), msg.sender, debtToReturn); } /// @param vaultId The vault to liquidate /// @notice Liquidates a vault with help from a Uniswap v3 flash loan function liquidate(bytes12 vaultId) external { uint24 poolFee = 3000; // 0.3% DataTypes.Vault memory vault = cauldron.vaults(vaultId); DataTypes.Balances memory balances = cauldron.balances(vaultId); DataTypes.Series memory series = cauldron.series(vault.seriesId); address base = cauldron.assets(series.baseId); address collateral = cauldron.assets(vault.ilkId); uint128 baseLoan = cauldron.debtToBase(vault.seriesId, balances.art); // tokens in PoolKey must be ordered bool ordered = (collateral < base); PoolAddress.PoolKey memory poolKey = PoolAddress.PoolKey({ token0: ordered ? collateral : base, token1: ordered ? base : collateral, fee: poolFee }); IUniswapV3Pool pool = IUniswapV3Pool(PoolAddress.computeAddress(factory, poolKey)); // data for the callback to know what to do FlashCallbackData memory args = FlashCallbackData({ vaultId: vaultId, base: base, collateral: collateral, baseLoan: baseLoan, baseJoin: address(witch.ladle().joins(series.baseId)), poolKey: poolKey }); // initiate flash loan, with the liquidation logic embedded in the flash loan callback pool.flash( address(this), ordered ? 0 : baseLoan, ordered ? baseLoan : 0, abi.encode( args ) ); } }
liquidate
function liquidate(bytes12 vaultId) external { uint24 poolFee = 3000; // 0.3% DataTypes.Vault memory vault = cauldron.vaults(vaultId); DataTypes.Balances memory balances = cauldron.balances(vaultId); DataTypes.Series memory series = cauldron.series(vault.seriesId); address base = cauldron.assets(series.baseId); address collateral = cauldron.assets(vault.ilkId); nt128 baseLoan = cauldron.debtToBase(vault.seriesId, balances.art); // tokens in PoolKey must be ordered bool ordered = (collateral < base); PoolAddress.PoolKey memory poolKey = PoolAddress.PoolKey({ token0: ordered ? collateral : base, token1: ordered ? base : collateral, fee: poolFee }); IUniswapV3Pool pool = IUniswapV3Pool(PoolAddress.computeAddress(factory, poolKey)); // data for the callback to know what to do FlashCallbackData memory args = FlashCallbackData({ vaultId: vaultId, base: base, collateral: collateral, baseLoan: baseLoan, baseJoin: address(witch.ladle().joins(series.baseId)), poolKey: poolKey }); // initiate flash loan, with the liquidation logic embedded in the flash loan callback pool.flash( address(this), ordered ? 0 : baseLoan, ordered ? baseLoan : 0, abi.encode( args ) ); }
/// @param vaultId The vault to liquidate /// @notice Liquidates a vault with help from a Uniswap v3 flash loan
NatSpecSingleLine
v0.8.6+commit.11564f7e
{ "func_code_index": [ 4273, 5779 ] }
5,774
LuckyNumber
LuckyNumber.sol
0x3ac0d29eaf16eb423e07387274a05a1e16a8472b
Solidity
LuckyNumber
contract LuckyNumber { address owner; uint winningNumber = uint(keccak256(now, owner)) % 10; function LuckyNumber() public { // The constructor. owner = msg.sender; } //Used for the owner to add money to the pot. function addBalance() public payable { } //fallback function, returns accidental payments to sender function() public payable { msg.sender.transfer(msg.value); } //explicit getter for "owner" function getOwner() view public returns (address) { return owner; } //explicit getter for "balance" function getBalance() view public returns (uint) { return this.balance; } //allows the owner to abort the contract and retrieve all funds function kill() public { if (msg.sender == owner) // only allow this action if the account sending the signal is the creator selfdestruct(owner); // kills this contract and sends remaining funds back to creator } /** *Take a guess. Transfer 0.00001 ETH to take a guess. 1/10 chance you are * correct. If you win, the function will transfer you 90% of the balance. * It will then kill the contract and return the remainder to the owner. */ function takeAGuess(uint _myGuess) public payable { require(msg.value == 0.0001 ether); if (_myGuess == winningNumber) { msg.sender.transfer((this.balance*9)/10); selfdestruct(owner); } } }
/** * Send 0.0001 to guess a random number from 1-10. Winner gets 90% of the pot. * 10% goes to the house. Note: house is supplying the initial pot so cry me a * river. */
NatSpecMultiLine
addBalance
function addBalance() public payable { }
//Used for the owner to add money to the pot.
LineComment
v0.4.19+commit.c4cbbb05
bzzr://b25167b26dd21d0705334e402b300ca36037e6952b1e8a53fd6634d6dcc9e5df
{ "func_code_index": [ 256, 306 ] }
5,775
LuckyNumber
LuckyNumber.sol
0x3ac0d29eaf16eb423e07387274a05a1e16a8472b
Solidity
LuckyNumber
contract LuckyNumber { address owner; uint winningNumber = uint(keccak256(now, owner)) % 10; function LuckyNumber() public { // The constructor. owner = msg.sender; } //Used for the owner to add money to the pot. function addBalance() public payable { } //fallback function, returns accidental payments to sender function() public payable { msg.sender.transfer(msg.value); } //explicit getter for "owner" function getOwner() view public returns (address) { return owner; } //explicit getter for "balance" function getBalance() view public returns (uint) { return this.balance; } //allows the owner to abort the contract and retrieve all funds function kill() public { if (msg.sender == owner) // only allow this action if the account sending the signal is the creator selfdestruct(owner); // kills this contract and sends remaining funds back to creator } /** *Take a guess. Transfer 0.00001 ETH to take a guess. 1/10 chance you are * correct. If you win, the function will transfer you 90% of the balance. * It will then kill the contract and return the remainder to the owner. */ function takeAGuess(uint _myGuess) public payable { require(msg.value == 0.0001 ether); if (_myGuess == winningNumber) { msg.sender.transfer((this.balance*9)/10); selfdestruct(owner); } } }
/** * Send 0.0001 to guess a random number from 1-10. Winner gets 90% of the pot. * 10% goes to the house. Note: house is supplying the initial pot so cry me a * river. */
NatSpecMultiLine
function() public payable { msg.sender.transfer(msg.value); }
//fallback function, returns accidental payments to sender
LineComment
v0.4.19+commit.c4cbbb05
bzzr://b25167b26dd21d0705334e402b300ca36037e6952b1e8a53fd6634d6dcc9e5df
{ "func_code_index": [ 373, 453 ] }
5,776
LuckyNumber
LuckyNumber.sol
0x3ac0d29eaf16eb423e07387274a05a1e16a8472b
Solidity
LuckyNumber
contract LuckyNumber { address owner; uint winningNumber = uint(keccak256(now, owner)) % 10; function LuckyNumber() public { // The constructor. owner = msg.sender; } //Used for the owner to add money to the pot. function addBalance() public payable { } //fallback function, returns accidental payments to sender function() public payable { msg.sender.transfer(msg.value); } //explicit getter for "owner" function getOwner() view public returns (address) { return owner; } //explicit getter for "balance" function getBalance() view public returns (uint) { return this.balance; } //allows the owner to abort the contract and retrieve all funds function kill() public { if (msg.sender == owner) // only allow this action if the account sending the signal is the creator selfdestruct(owner); // kills this contract and sends remaining funds back to creator } /** *Take a guess. Transfer 0.00001 ETH to take a guess. 1/10 chance you are * correct. If you win, the function will transfer you 90% of the balance. * It will then kill the contract and return the remainder to the owner. */ function takeAGuess(uint _myGuess) public payable { require(msg.value == 0.0001 ether); if (_myGuess == winningNumber) { msg.sender.transfer((this.balance*9)/10); selfdestruct(owner); } } }
/** * Send 0.0001 to guess a random number from 1-10. Winner gets 90% of the pot. * 10% goes to the house. Note: house is supplying the initial pot so cry me a * river. */
NatSpecMultiLine
getOwner
function getOwner() view public returns (address) { return owner; }
//explicit getter for "owner"
LineComment
v0.4.19+commit.c4cbbb05
bzzr://b25167b26dd21d0705334e402b300ca36037e6952b1e8a53fd6634d6dcc9e5df
{ "func_code_index": [ 495, 582 ] }
5,777
LuckyNumber
LuckyNumber.sol
0x3ac0d29eaf16eb423e07387274a05a1e16a8472b
Solidity
LuckyNumber
contract LuckyNumber { address owner; uint winningNumber = uint(keccak256(now, owner)) % 10; function LuckyNumber() public { // The constructor. owner = msg.sender; } //Used for the owner to add money to the pot. function addBalance() public payable { } //fallback function, returns accidental payments to sender function() public payable { msg.sender.transfer(msg.value); } //explicit getter for "owner" function getOwner() view public returns (address) { return owner; } //explicit getter for "balance" function getBalance() view public returns (uint) { return this.balance; } //allows the owner to abort the contract and retrieve all funds function kill() public { if (msg.sender == owner) // only allow this action if the account sending the signal is the creator selfdestruct(owner); // kills this contract and sends remaining funds back to creator } /** *Take a guess. Transfer 0.00001 ETH to take a guess. 1/10 chance you are * correct. If you win, the function will transfer you 90% of the balance. * It will then kill the contract and return the remainder to the owner. */ function takeAGuess(uint _myGuess) public payable { require(msg.value == 0.0001 ether); if (_myGuess == winningNumber) { msg.sender.transfer((this.balance*9)/10); selfdestruct(owner); } } }
/** * Send 0.0001 to guess a random number from 1-10. Winner gets 90% of the pot. * 10% goes to the house. Note: house is supplying the initial pot so cry me a * river. */
NatSpecMultiLine
getBalance
function getBalance() view public returns (uint) { return this.balance; }
//explicit getter for "balance"
LineComment
v0.4.19+commit.c4cbbb05
bzzr://b25167b26dd21d0705334e402b300ca36037e6952b1e8a53fd6634d6dcc9e5df
{ "func_code_index": [ 622, 714 ] }
5,778
LuckyNumber
LuckyNumber.sol
0x3ac0d29eaf16eb423e07387274a05a1e16a8472b
Solidity
LuckyNumber
contract LuckyNumber { address owner; uint winningNumber = uint(keccak256(now, owner)) % 10; function LuckyNumber() public { // The constructor. owner = msg.sender; } //Used for the owner to add money to the pot. function addBalance() public payable { } //fallback function, returns accidental payments to sender function() public payable { msg.sender.transfer(msg.value); } //explicit getter for "owner" function getOwner() view public returns (address) { return owner; } //explicit getter for "balance" function getBalance() view public returns (uint) { return this.balance; } //allows the owner to abort the contract and retrieve all funds function kill() public { if (msg.sender == owner) // only allow this action if the account sending the signal is the creator selfdestruct(owner); // kills this contract and sends remaining funds back to creator } /** *Take a guess. Transfer 0.00001 ETH to take a guess. 1/10 chance you are * correct. If you win, the function will transfer you 90% of the balance. * It will then kill the contract and return the remainder to the owner. */ function takeAGuess(uint _myGuess) public payable { require(msg.value == 0.0001 ether); if (_myGuess == winningNumber) { msg.sender.transfer((this.balance*9)/10); selfdestruct(owner); } } }
/** * Send 0.0001 to guess a random number from 1-10. Winner gets 90% of the pot. * 10% goes to the house. Note: house is supplying the initial pot so cry me a * river. */
NatSpecMultiLine
kill
function kill() public { if (msg.sender == owner) // only allow this action if the account sending the signal is the creator selfdestruct(owner); // kills this contract and sends remaining funds back to creator }
//allows the owner to abort the contract and retrieve all funds
LineComment
v0.4.19+commit.c4cbbb05
bzzr://b25167b26dd21d0705334e402b300ca36037e6952b1e8a53fd6634d6dcc9e5df
{ "func_code_index": [ 786, 1038 ] }
5,779
LuckyNumber
LuckyNumber.sol
0x3ac0d29eaf16eb423e07387274a05a1e16a8472b
Solidity
LuckyNumber
contract LuckyNumber { address owner; uint winningNumber = uint(keccak256(now, owner)) % 10; function LuckyNumber() public { // The constructor. owner = msg.sender; } //Used for the owner to add money to the pot. function addBalance() public payable { } //fallback function, returns accidental payments to sender function() public payable { msg.sender.transfer(msg.value); } //explicit getter for "owner" function getOwner() view public returns (address) { return owner; } //explicit getter for "balance" function getBalance() view public returns (uint) { return this.balance; } //allows the owner to abort the contract and retrieve all funds function kill() public { if (msg.sender == owner) // only allow this action if the account sending the signal is the creator selfdestruct(owner); // kills this contract and sends remaining funds back to creator } /** *Take a guess. Transfer 0.00001 ETH to take a guess. 1/10 chance you are * correct. If you win, the function will transfer you 90% of the balance. * It will then kill the contract and return the remainder to the owner. */ function takeAGuess(uint _myGuess) public payable { require(msg.value == 0.0001 ether); if (_myGuess == winningNumber) { msg.sender.transfer((this.balance*9)/10); selfdestruct(owner); } } }
/** * Send 0.0001 to guess a random number from 1-10. Winner gets 90% of the pot. * 10% goes to the house. Note: house is supplying the initial pot so cry me a * river. */
NatSpecMultiLine
takeAGuess
function takeAGuess(uint _myGuess) public payable { require(msg.value == 0.0001 ether); if (_myGuess == winningNumber) { msg.sender.transfer((this.balance*9)/10); selfdestruct(owner); } }
/** *Take a guess. Transfer 0.00001 ETH to take a guess. 1/10 chance you are * correct. If you win, the function will transfer you 90% of the balance. * It will then kill the contract and return the remainder to the owner. */
NatSpecMultiLine
v0.4.19+commit.c4cbbb05
bzzr://b25167b26dd21d0705334e402b300ca36037e6952b1e8a53fd6634d6dcc9e5df
{ "func_code_index": [ 1298, 1548 ] }
5,780
TickerRegistry
TickerRegistry.sol
0xc31714e6759a1ee26db1d06af1ed276340cd4233
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://1c3fd67e0e5dae16f4d5818e4def156aa71b9a6925640af36a76c616a54e724c
{ "func_code_index": [ 89, 476 ] }
5,781
TickerRegistry
TickerRegistry.sol
0xc31714e6759a1ee26db1d06af1ed276340cd4233
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://1c3fd67e0e5dae16f4d5818e4def156aa71b9a6925640af36a76c616a54e724c
{ "func_code_index": [ 560, 840 ] }
5,782
TickerRegistry
TickerRegistry.sol
0xc31714e6759a1ee26db1d06af1ed276340cd4233
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://1c3fd67e0e5dae16f4d5818e4def156aa71b9a6925640af36a76c616a54e724c
{ "func_code_index": [ 954, 1070 ] }
5,783
TickerRegistry
TickerRegistry.sol
0xc31714e6759a1ee26db1d06af1ed276340cd4233
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://1c3fd67e0e5dae16f4d5818e4def156aa71b9a6925640af36a76c616a54e724c
{ "func_code_index": [ 1134, 1264 ] }
5,784
TickerRegistry
TickerRegistry.sol
0xc31714e6759a1ee26db1d06af1ed276340cd4233
Solidity
ITickerRegistry
contract ITickerRegistry { /** * @notice Check the validity of the symbol * @param _symbol token symbol * @param _owner address of the owner * @param _tokenName Name of the token * @return bool */ function checkValidity(string _symbol, address _owner, string _tokenName) public returns(bool); /** * @notice Returns the owner and timestamp for a given symbol * @param _symbol symbol */ function getDetails(string _symbol) public view returns (address, uint256, string, bytes32, bool); /** * @notice Check the symbol is reserved or not * @param _symbol Symbol of the token * @return bool */ function isReserved(string _symbol, address _owner, string _tokenName, bytes32 _swarmHash) public returns(bool); }
/** * @title Interface for the polymath ticker registry contract */
NatSpecMultiLine
checkValidity
function checkValidity(string _symbol, address _owner, string _tokenName) public returns(bool);
/** * @notice Check the validity of the symbol * @param _symbol token symbol * @param _owner address of the owner * @param _tokenName Name of the token * @return bool */
NatSpecMultiLine
v0.4.24+commit.e67f0147
bzzr://1c3fd67e0e5dae16f4d5818e4def156aa71b9a6925640af36a76c616a54e724c
{ "func_code_index": [ 233, 333 ] }
5,785
TickerRegistry
TickerRegistry.sol
0xc31714e6759a1ee26db1d06af1ed276340cd4233
Solidity
ITickerRegistry
contract ITickerRegistry { /** * @notice Check the validity of the symbol * @param _symbol token symbol * @param _owner address of the owner * @param _tokenName Name of the token * @return bool */ function checkValidity(string _symbol, address _owner, string _tokenName) public returns(bool); /** * @notice Returns the owner and timestamp for a given symbol * @param _symbol symbol */ function getDetails(string _symbol) public view returns (address, uint256, string, bytes32, bool); /** * @notice Check the symbol is reserved or not * @param _symbol Symbol of the token * @return bool */ function isReserved(string _symbol, address _owner, string _tokenName, bytes32 _swarmHash) public returns(bool); }
/** * @title Interface for the polymath ticker registry contract */
NatSpecMultiLine
getDetails
function getDetails(string _symbol) public view returns (address, uint256, string, bytes32, bool);
/** * @notice Returns the owner and timestamp for a given symbol * @param _symbol symbol */
NatSpecMultiLine
v0.4.24+commit.e67f0147
bzzr://1c3fd67e0e5dae16f4d5818e4def156aa71b9a6925640af36a76c616a54e724c
{ "func_code_index": [ 448, 551 ] }
5,786
TickerRegistry
TickerRegistry.sol
0xc31714e6759a1ee26db1d06af1ed276340cd4233
Solidity
ITickerRegistry
contract ITickerRegistry { /** * @notice Check the validity of the symbol * @param _symbol token symbol * @param _owner address of the owner * @param _tokenName Name of the token * @return bool */ function checkValidity(string _symbol, address _owner, string _tokenName) public returns(bool); /** * @notice Returns the owner and timestamp for a given symbol * @param _symbol symbol */ function getDetails(string _symbol) public view returns (address, uint256, string, bytes32, bool); /** * @notice Check the symbol is reserved or not * @param _symbol Symbol of the token * @return bool */ function isReserved(string _symbol, address _owner, string _tokenName, bytes32 _swarmHash) public returns(bool); }
/** * @title Interface for the polymath ticker registry contract */
NatSpecMultiLine
isReserved
function isReserved(string _symbol, address _owner, string _tokenName, bytes32 _swarmHash) public returns(bool);
/** * @notice Check the symbol is reserved or not * @param _symbol Symbol of the token * @return bool */
NatSpecMultiLine
v0.4.24+commit.e67f0147
bzzr://1c3fd67e0e5dae16f4d5818e4def156aa71b9a6925640af36a76c616a54e724c
{ "func_code_index": [ 688, 806 ] }
5,787
TickerRegistry
TickerRegistry.sol
0xc31714e6759a1ee26db1d06af1ed276340cd4233
Solidity
Util
contract Util { /** * @notice changes a string to upper case * @param _base string to change */ function upper(string _base) internal pure returns (string) { bytes memory _baseBytes = bytes(_base); for (uint i = 0; i < _baseBytes.length; i++) { bytes1 b1 = _baseBytes[i]; if (b1 >= 0x61 && b1 <= 0x7A) { b1 = bytes1(uint8(b1)-32); } _baseBytes[i] = b1; } return string(_baseBytes); } }
/** * @title Utility contract for reusable code */
NatSpecMultiLine
upper
function upper(string _base) internal pure returns (string) { bytes memory _baseBytes = bytes(_base); for (uint i = 0; i < _baseBytes.length; i++) { bytes1 b1 = _baseBytes[i]; if (b1 >= 0x61 && b1 <= 0x7A) { b1 = bytes1(uint8(b1)-32); } _baseBytes[i] = b1; } return string(_baseBytes); }
/** * @notice changes a string to upper case * @param _base string to change */
NatSpecMultiLine
v0.4.24+commit.e67f0147
bzzr://1c3fd67e0e5dae16f4d5818e4def156aa71b9a6925640af36a76c616a54e724c
{ "func_code_index": [ 118, 520 ] }
5,788
TickerRegistry
TickerRegistry.sol
0xc31714e6759a1ee26db1d06af1ed276340cd4233
Solidity
Pausable
contract Pausable { event Pause(uint256 _timestammp); event Unpause(uint256 _timestamp); bool public paused = false; /** * @notice Modifier to make a function callable only when the contract is not paused. */ modifier whenNotPaused() { require(!paused); _; } /** * @notice Modifier to make a function callable only when the contract is paused. */ modifier whenPaused() { require(paused); _; } /** * @notice called by the owner to pause, triggers stopped state */ function _pause() internal { require(!paused); paused = true; emit Pause(now); } /** * @notice called by the owner to unpause, returns to normal state */ function _unpause() internal { require(paused); paused = false; emit Unpause(now); } }
/** * @title Utility contract to allow pausing and unpausing of certain functions */
NatSpecMultiLine
_pause
function _pause() internal { require(!paused); paused = true; emit Pause(now); }
/** * @notice called by the owner to pause, triggers stopped state */
NatSpecMultiLine
v0.4.24+commit.e67f0147
bzzr://1c3fd67e0e5dae16f4d5818e4def156aa71b9a6925640af36a76c616a54e724c
{ "func_code_index": [ 589, 706 ] }
5,789
TickerRegistry
TickerRegistry.sol
0xc31714e6759a1ee26db1d06af1ed276340cd4233
Solidity
Pausable
contract Pausable { event Pause(uint256 _timestammp); event Unpause(uint256 _timestamp); bool public paused = false; /** * @notice Modifier to make a function callable only when the contract is not paused. */ modifier whenNotPaused() { require(!paused); _; } /** * @notice Modifier to make a function callable only when the contract is paused. */ modifier whenPaused() { require(paused); _; } /** * @notice called by the owner to pause, triggers stopped state */ function _pause() internal { require(!paused); paused = true; emit Pause(now); } /** * @notice called by the owner to unpause, returns to normal state */ function _unpause() internal { require(paused); paused = false; emit Unpause(now); } }
/** * @title Utility contract to allow pausing and unpausing of certain functions */
NatSpecMultiLine
_unpause
function _unpause() internal { require(paused); paused = false; emit Unpause(now); }
/** * @notice called by the owner to unpause, returns to normal state */
NatSpecMultiLine
v0.4.24+commit.e67f0147
bzzr://1c3fd67e0e5dae16f4d5818e4def156aa71b9a6925640af36a76c616a54e724c
{ "func_code_index": [ 797, 918 ] }
5,790
TickerRegistry
TickerRegistry.sol
0xc31714e6759a1ee26db1d06af1ed276340cd4233
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. */ 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. */
NatSpecMultiLine
v0.4.24+commit.e67f0147
bzzr://1c3fd67e0e5dae16f4d5818e4def156aa71b9a6925640af36a76c616a54e724c
{ "func_code_index": [ 638, 755 ] }
5,791
TickerRegistry
TickerRegistry.sol
0xc31714e6759a1ee26db1d06af1ed276340cd4233
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. */ 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://1c3fd67e0e5dae16f4d5818e4def156aa71b9a6925640af36a76c616a54e724c
{ "func_code_index": [ 920, 1028 ] }
5,792
TickerRegistry
TickerRegistry.sol
0xc31714e6759a1ee26db1d06af1ed276340cd4233
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. */ 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://1c3fd67e0e5dae16f4d5818e4def156aa71b9a6925640af36a76c616a54e724c
{ "func_code_index": [ 1166, 1344 ] }
5,793
TickerRegistry
TickerRegistry.sol
0xc31714e6759a1ee26db1d06af1ed276340cd4233
Solidity
ReclaimTokens
contract ReclaimTokens is Ownable { /** * @notice Reclaim all ERC20Basic compatible tokens * @param _tokenContract The address of the token contract */ function reclaimERC20(address _tokenContract) external onlyOwner { require(_tokenContract != address(0)); ERC20Basic token = ERC20Basic(_tokenContract); uint256 balance = token.balanceOf(address(this)); require(token.transfer(owner, balance)); } }
/** * @title Utility contract to allow owner to retreive any ERC20 sent to the contract */
NatSpecMultiLine
reclaimERC20
function reclaimERC20(address _tokenContract) external onlyOwner { require(_tokenContract != address(0)); ERC20Basic token = ERC20Basic(_tokenContract); uint256 balance = token.balanceOf(address(this)); require(token.transfer(owner, balance)); }
/** * @notice Reclaim all ERC20Basic compatible tokens * @param _tokenContract The address of the token contract */
NatSpecMultiLine
v0.4.24+commit.e67f0147
bzzr://1c3fd67e0e5dae16f4d5818e4def156aa71b9a6925640af36a76c616a54e724c
{ "func_code_index": [ 175, 466 ] }
5,794
TickerRegistry
TickerRegistry.sol
0xc31714e6759a1ee26db1d06af1ed276340cd4233
Solidity
PolymathRegistry
contract PolymathRegistry is ReclaimTokens { mapping (bytes32 => address) public storedAddresses; event LogChangeAddress(string _nameKey, address indexed _oldAddress, address indexed _newAddress); /** * @notice Get the contract address * @param _nameKey is the key for the contract address mapping * @return address */ function getAddress(string _nameKey) view public returns(address) { bytes32 key = keccak256(bytes(_nameKey)); require(storedAddresses[key] != address(0), "Invalid address key"); return storedAddresses[key]; } /** * @notice change the contract address * @param _nameKey is the key for the contract address mapping * @param _newAddress is the new contract address */ function changeAddress(string _nameKey, address _newAddress) public onlyOwner { bytes32 key = keccak256(bytes(_nameKey)); emit LogChangeAddress(_nameKey, storedAddresses[key], _newAddress); storedAddresses[key] = _newAddress; } }
/** * @title Core functionality for registry upgradability */
NatSpecMultiLine
getAddress
function getAddress(string _nameKey) view public returns(address) { bytes32 key = keccak256(bytes(_nameKey)); require(storedAddresses[key] != address(0), "Invalid address key"); return storedAddresses[key]; }
/** * @notice Get the contract address * @param _nameKey is the key for the contract address mapping * @return address */
NatSpecMultiLine
v0.4.24+commit.e67f0147
bzzr://1c3fd67e0e5dae16f4d5818e4def156aa71b9a6925640af36a76c616a54e724c
{ "func_code_index": [ 365, 610 ] }
5,795
TickerRegistry
TickerRegistry.sol
0xc31714e6759a1ee26db1d06af1ed276340cd4233
Solidity
PolymathRegistry
contract PolymathRegistry is ReclaimTokens { mapping (bytes32 => address) public storedAddresses; event LogChangeAddress(string _nameKey, address indexed _oldAddress, address indexed _newAddress); /** * @notice Get the contract address * @param _nameKey is the key for the contract address mapping * @return address */ function getAddress(string _nameKey) view public returns(address) { bytes32 key = keccak256(bytes(_nameKey)); require(storedAddresses[key] != address(0), "Invalid address key"); return storedAddresses[key]; } /** * @notice change the contract address * @param _nameKey is the key for the contract address mapping * @param _newAddress is the new contract address */ function changeAddress(string _nameKey, address _newAddress) public onlyOwner { bytes32 key = keccak256(bytes(_nameKey)); emit LogChangeAddress(_nameKey, storedAddresses[key], _newAddress); storedAddresses[key] = _newAddress; } }
/** * @title Core functionality for registry upgradability */
NatSpecMultiLine
changeAddress
function changeAddress(string _nameKey, address _newAddress) public onlyOwner { bytes32 key = keccak256(bytes(_nameKey)); emit LogChangeAddress(_nameKey, storedAddresses[key], _newAddress); storedAddresses[key] = _newAddress; }
/** * @notice change the contract address * @param _nameKey is the key for the contract address mapping * @param _newAddress is the new contract address */
NatSpecMultiLine
v0.4.24+commit.e67f0147
bzzr://1c3fd67e0e5dae16f4d5818e4def156aa71b9a6925640af36a76c616a54e724c
{ "func_code_index": [ 798, 1062 ] }
5,796
TickerRegistry
TickerRegistry.sol
0xc31714e6759a1ee26db1d06af1ed276340cd4233
Solidity
TickerRegistry
contract TickerRegistry is ITickerRegistry, Util, Pausable, RegistryUpdater, ReclaimTokens { using SafeMath for uint256; // constant variable to check the validity to use the symbol // For now it's value is 15 days; uint256 public expiryLimit = 15 * 1 days; // Details of the symbol that get registered with the polymath platform struct SymbolDetails { address owner; uint256 timestamp; string tokenName; bytes32 swarmHash; bool status; } // Storage of symbols correspond to their details. mapping(string => SymbolDetails) registeredSymbols; // Emit after the symbol registration event LogRegisterTicker(address indexed _owner, string _symbol, string _name, bytes32 _swarmHash, uint256 indexed _timestamp); // Emit when the token symbol expiry get changed event LogChangeExpiryLimit(uint256 _oldExpiry, uint256 _newExpiry); // Registration fee in POLY base 18 decimals uint256 public registrationFee; // Emit when changePolyRegisterationFee is called event LogChangePolyRegisterationFee(uint256 _oldFee, uint256 _newFee); constructor (address _polymathRegistry, uint256 _registrationFee) public RegistryUpdater(_polymathRegistry) { registrationFee = _registrationFee; } /** * @notice Register the token symbol for its particular owner * @notice Once the token symbol is registered to its owner then no other issuer can claim * @notice its ownership. If the symbol expires and its issuer hasn't used it, then someone else can take it. * @param _symbol token symbol * @param _tokenName Name of the token * @param _owner Address of the owner of the token * @param _swarmHash Off-chain details of the issuer and token */ function registerTicker(address _owner, string _symbol, string _tokenName, bytes32 _swarmHash) public whenNotPaused { require(_owner != address(0), "Owner should not be 0x"); require(bytes(_symbol).length > 0 && bytes(_symbol).length <= 10, "Ticker length should always between 0 & 10"); if(registrationFee > 0) require(ERC20(polyToken).transferFrom(msg.sender, this, registrationFee), "Failed transferFrom because of sufficent Allowance is not provided"); string memory symbol = upper(_symbol); require(expiryCheck(symbol), "Ticker is already reserved"); registeredSymbols[symbol] = SymbolDetails(_owner, now, _tokenName, _swarmHash, false); emit LogRegisterTicker (_owner, symbol, _tokenName, _swarmHash, now); } /** * @notice Change the expiry time for the token symbol * @param _newExpiry new time period for token symbol expiry */ function changeExpiryLimit(uint256 _newExpiry) public onlyOwner { require(_newExpiry >= 1 days, "Expiry should greater than or equal to 1 day"); uint256 _oldExpiry = expiryLimit; expiryLimit = _newExpiry; emit LogChangeExpiryLimit(_oldExpiry, _newExpiry); } /** * @notice Check the validity of the symbol * @param _symbol token symbol * @param _owner address of the owner * @param _tokenName Name of the token * @return bool */ function checkValidity(string _symbol, address _owner, string _tokenName) public returns(bool) { string memory symbol = upper(_symbol); require(msg.sender == securityTokenRegistry, "msg.sender should be SecurityTokenRegistry contract"); require(registeredSymbols[symbol].status != true, "Symbol status should not equal to true"); require(registeredSymbols[symbol].owner == _owner, "Owner of the symbol should matched with the requested issuer address"); require(registeredSymbols[symbol].timestamp.add(expiryLimit) >= now, "Ticker should not be expired"); registeredSymbols[symbol].tokenName = _tokenName; registeredSymbols[symbol].status = true; return true; } /** * @notice Check the symbol is reserved or not * @param _symbol Symbol of the token * @param _owner Owner of the token * @param _tokenName Name of the token * @param _swarmHash off-chain hash * @return bool */ function isReserved(string _symbol, address _owner, string _tokenName, bytes32 _swarmHash) public returns(bool) { string memory symbol = upper(_symbol); require(msg.sender == securityTokenRegistry, "msg.sender should be SecurityTokenRegistry contract"); if (registeredSymbols[symbol].owner == _owner && !expiryCheck(_symbol)) { registeredSymbols[symbol].status = true; return false; } else if (registeredSymbols[symbol].owner == address(0) || expiryCheck(symbol)) { registeredSymbols[symbol] = SymbolDetails(_owner, now, _tokenName, _swarmHash, true); emit LogRegisterTicker (_owner, symbol, _tokenName, _swarmHash, now); return false; } else return true; } /** * @notice Returns the owner and timestamp for a given symbol * @param _symbol symbol * @return address * @return uint256 * @return string * @return bytes32 * @return bool */ function getDetails(string _symbol) public view returns (address, uint256, string, bytes32, bool) { string memory symbol = upper(_symbol); if (registeredSymbols[symbol].status == true||registeredSymbols[symbol].timestamp.add(expiryLimit) > now) { return ( registeredSymbols[symbol].owner, registeredSymbols[symbol].timestamp, registeredSymbols[symbol].tokenName, registeredSymbols[symbol].swarmHash, registeredSymbols[symbol].status ); }else return (address(0), uint256(0), "", bytes32(0), false); } /** * @notice To re-initialize the token symbol details if symbol validity expires * @param _symbol token symbol * @return bool */ function expiryCheck(string _symbol) internal returns(bool) { if (registeredSymbols[_symbol].owner != address(0)) { if (now > registeredSymbols[_symbol].timestamp.add(expiryLimit) && registeredSymbols[_symbol].status != true) { registeredSymbols[_symbol] = SymbolDetails(address(0), uint256(0), "", bytes32(0), false); return true; }else return false; } return true; } /** * @notice set the ticker registration fee in POLY tokens * @param _registrationFee registration fee in POLY tokens (base 18 decimals) */ function changePolyRegisterationFee(uint256 _registrationFee) public onlyOwner { require(registrationFee != _registrationFee); emit LogChangePolyRegisterationFee(registrationFee, _registrationFee); registrationFee = _registrationFee; } /** * @notice pause registration function */ function unpause() public onlyOwner { _unpause(); } /** * @notice unpause registration function */ function pause() public onlyOwner { _pause(); } }
/** * @title Registry contract for issuers to reserve their security token symbols * @notice Allows issuers to reserve their token symbols ahead of actually generating their security token. * @dev SecurityTokenRegistry would reference this contract and ensure that a token symbol exists here and only its owner can deploy the token with that symbol. */
NatSpecMultiLine
registerTicker
function registerTicker(address _owner, string _symbol, string _tokenName, bytes32 _swarmHash) public whenNotPaused { require(_owner != address(0), "Owner should not be 0x"); require(bytes(_symbol).length > 0 && bytes(_symbol).length <= 10, "Ticker length should always between 0 & 10"); if(registrationFee > 0) require(ERC20(polyToken).transferFrom(msg.sender, this, registrationFee), "Failed transferFrom because of sufficent Allowance is not provided"); string memory symbol = upper(_symbol); require(expiryCheck(symbol), "Ticker is already reserved"); registeredSymbols[symbol] = SymbolDetails(_owner, now, _tokenName, _swarmHash, false); emit LogRegisterTicker (_owner, symbol, _tokenName, _swarmHash, now); }
/** * @notice Register the token symbol for its particular owner * @notice Once the token symbol is registered to its owner then no other issuer can claim * @notice its ownership. If the symbol expires and its issuer hasn't used it, then someone else can take it. * @param _symbol token symbol * @param _tokenName Name of the token * @param _owner Address of the owner of the token * @param _swarmHash Off-chain details of the issuer and token */
NatSpecMultiLine
v0.4.24+commit.e67f0147
bzzr://1c3fd67e0e5dae16f4d5818e4def156aa71b9a6925640af36a76c616a54e724c
{ "func_code_index": [ 1844, 2644 ] }
5,797
TickerRegistry
TickerRegistry.sol
0xc31714e6759a1ee26db1d06af1ed276340cd4233
Solidity
TickerRegistry
contract TickerRegistry is ITickerRegistry, Util, Pausable, RegistryUpdater, ReclaimTokens { using SafeMath for uint256; // constant variable to check the validity to use the symbol // For now it's value is 15 days; uint256 public expiryLimit = 15 * 1 days; // Details of the symbol that get registered with the polymath platform struct SymbolDetails { address owner; uint256 timestamp; string tokenName; bytes32 swarmHash; bool status; } // Storage of symbols correspond to their details. mapping(string => SymbolDetails) registeredSymbols; // Emit after the symbol registration event LogRegisterTicker(address indexed _owner, string _symbol, string _name, bytes32 _swarmHash, uint256 indexed _timestamp); // Emit when the token symbol expiry get changed event LogChangeExpiryLimit(uint256 _oldExpiry, uint256 _newExpiry); // Registration fee in POLY base 18 decimals uint256 public registrationFee; // Emit when changePolyRegisterationFee is called event LogChangePolyRegisterationFee(uint256 _oldFee, uint256 _newFee); constructor (address _polymathRegistry, uint256 _registrationFee) public RegistryUpdater(_polymathRegistry) { registrationFee = _registrationFee; } /** * @notice Register the token symbol for its particular owner * @notice Once the token symbol is registered to its owner then no other issuer can claim * @notice its ownership. If the symbol expires and its issuer hasn't used it, then someone else can take it. * @param _symbol token symbol * @param _tokenName Name of the token * @param _owner Address of the owner of the token * @param _swarmHash Off-chain details of the issuer and token */ function registerTicker(address _owner, string _symbol, string _tokenName, bytes32 _swarmHash) public whenNotPaused { require(_owner != address(0), "Owner should not be 0x"); require(bytes(_symbol).length > 0 && bytes(_symbol).length <= 10, "Ticker length should always between 0 & 10"); if(registrationFee > 0) require(ERC20(polyToken).transferFrom(msg.sender, this, registrationFee), "Failed transferFrom because of sufficent Allowance is not provided"); string memory symbol = upper(_symbol); require(expiryCheck(symbol), "Ticker is already reserved"); registeredSymbols[symbol] = SymbolDetails(_owner, now, _tokenName, _swarmHash, false); emit LogRegisterTicker (_owner, symbol, _tokenName, _swarmHash, now); } /** * @notice Change the expiry time for the token symbol * @param _newExpiry new time period for token symbol expiry */ function changeExpiryLimit(uint256 _newExpiry) public onlyOwner { require(_newExpiry >= 1 days, "Expiry should greater than or equal to 1 day"); uint256 _oldExpiry = expiryLimit; expiryLimit = _newExpiry; emit LogChangeExpiryLimit(_oldExpiry, _newExpiry); } /** * @notice Check the validity of the symbol * @param _symbol token symbol * @param _owner address of the owner * @param _tokenName Name of the token * @return bool */ function checkValidity(string _symbol, address _owner, string _tokenName) public returns(bool) { string memory symbol = upper(_symbol); require(msg.sender == securityTokenRegistry, "msg.sender should be SecurityTokenRegistry contract"); require(registeredSymbols[symbol].status != true, "Symbol status should not equal to true"); require(registeredSymbols[symbol].owner == _owner, "Owner of the symbol should matched with the requested issuer address"); require(registeredSymbols[symbol].timestamp.add(expiryLimit) >= now, "Ticker should not be expired"); registeredSymbols[symbol].tokenName = _tokenName; registeredSymbols[symbol].status = true; return true; } /** * @notice Check the symbol is reserved or not * @param _symbol Symbol of the token * @param _owner Owner of the token * @param _tokenName Name of the token * @param _swarmHash off-chain hash * @return bool */ function isReserved(string _symbol, address _owner, string _tokenName, bytes32 _swarmHash) public returns(bool) { string memory symbol = upper(_symbol); require(msg.sender == securityTokenRegistry, "msg.sender should be SecurityTokenRegistry contract"); if (registeredSymbols[symbol].owner == _owner && !expiryCheck(_symbol)) { registeredSymbols[symbol].status = true; return false; } else if (registeredSymbols[symbol].owner == address(0) || expiryCheck(symbol)) { registeredSymbols[symbol] = SymbolDetails(_owner, now, _tokenName, _swarmHash, true); emit LogRegisterTicker (_owner, symbol, _tokenName, _swarmHash, now); return false; } else return true; } /** * @notice Returns the owner and timestamp for a given symbol * @param _symbol symbol * @return address * @return uint256 * @return string * @return bytes32 * @return bool */ function getDetails(string _symbol) public view returns (address, uint256, string, bytes32, bool) { string memory symbol = upper(_symbol); if (registeredSymbols[symbol].status == true||registeredSymbols[symbol].timestamp.add(expiryLimit) > now) { return ( registeredSymbols[symbol].owner, registeredSymbols[symbol].timestamp, registeredSymbols[symbol].tokenName, registeredSymbols[symbol].swarmHash, registeredSymbols[symbol].status ); }else return (address(0), uint256(0), "", bytes32(0), false); } /** * @notice To re-initialize the token symbol details if symbol validity expires * @param _symbol token symbol * @return bool */ function expiryCheck(string _symbol) internal returns(bool) { if (registeredSymbols[_symbol].owner != address(0)) { if (now > registeredSymbols[_symbol].timestamp.add(expiryLimit) && registeredSymbols[_symbol].status != true) { registeredSymbols[_symbol] = SymbolDetails(address(0), uint256(0), "", bytes32(0), false); return true; }else return false; } return true; } /** * @notice set the ticker registration fee in POLY tokens * @param _registrationFee registration fee in POLY tokens (base 18 decimals) */ function changePolyRegisterationFee(uint256 _registrationFee) public onlyOwner { require(registrationFee != _registrationFee); emit LogChangePolyRegisterationFee(registrationFee, _registrationFee); registrationFee = _registrationFee; } /** * @notice pause registration function */ function unpause() public onlyOwner { _unpause(); } /** * @notice unpause registration function */ function pause() public onlyOwner { _pause(); } }
/** * @title Registry contract for issuers to reserve their security token symbols * @notice Allows issuers to reserve their token symbols ahead of actually generating their security token. * @dev SecurityTokenRegistry would reference this contract and ensure that a token symbol exists here and only its owner can deploy the token with that symbol. */
NatSpecMultiLine
changeExpiryLimit
function changeExpiryLimit(uint256 _newExpiry) public onlyOwner { require(_newExpiry >= 1 days, "Expiry should greater than or equal to 1 day"); uint256 _oldExpiry = expiryLimit; expiryLimit = _newExpiry; emit LogChangeExpiryLimit(_oldExpiry, _newExpiry); }
/** * @notice Change the expiry time for the token symbol * @param _newExpiry new time period for token symbol expiry */
NatSpecMultiLine
v0.4.24+commit.e67f0147
bzzr://1c3fd67e0e5dae16f4d5818e4def156aa71b9a6925640af36a76c616a54e724c
{ "func_code_index": [ 2791, 3094 ] }
5,798
TickerRegistry
TickerRegistry.sol
0xc31714e6759a1ee26db1d06af1ed276340cd4233
Solidity
TickerRegistry
contract TickerRegistry is ITickerRegistry, Util, Pausable, RegistryUpdater, ReclaimTokens { using SafeMath for uint256; // constant variable to check the validity to use the symbol // For now it's value is 15 days; uint256 public expiryLimit = 15 * 1 days; // Details of the symbol that get registered with the polymath platform struct SymbolDetails { address owner; uint256 timestamp; string tokenName; bytes32 swarmHash; bool status; } // Storage of symbols correspond to their details. mapping(string => SymbolDetails) registeredSymbols; // Emit after the symbol registration event LogRegisterTicker(address indexed _owner, string _symbol, string _name, bytes32 _swarmHash, uint256 indexed _timestamp); // Emit when the token symbol expiry get changed event LogChangeExpiryLimit(uint256 _oldExpiry, uint256 _newExpiry); // Registration fee in POLY base 18 decimals uint256 public registrationFee; // Emit when changePolyRegisterationFee is called event LogChangePolyRegisterationFee(uint256 _oldFee, uint256 _newFee); constructor (address _polymathRegistry, uint256 _registrationFee) public RegistryUpdater(_polymathRegistry) { registrationFee = _registrationFee; } /** * @notice Register the token symbol for its particular owner * @notice Once the token symbol is registered to its owner then no other issuer can claim * @notice its ownership. If the symbol expires and its issuer hasn't used it, then someone else can take it. * @param _symbol token symbol * @param _tokenName Name of the token * @param _owner Address of the owner of the token * @param _swarmHash Off-chain details of the issuer and token */ function registerTicker(address _owner, string _symbol, string _tokenName, bytes32 _swarmHash) public whenNotPaused { require(_owner != address(0), "Owner should not be 0x"); require(bytes(_symbol).length > 0 && bytes(_symbol).length <= 10, "Ticker length should always between 0 & 10"); if(registrationFee > 0) require(ERC20(polyToken).transferFrom(msg.sender, this, registrationFee), "Failed transferFrom because of sufficent Allowance is not provided"); string memory symbol = upper(_symbol); require(expiryCheck(symbol), "Ticker is already reserved"); registeredSymbols[symbol] = SymbolDetails(_owner, now, _tokenName, _swarmHash, false); emit LogRegisterTicker (_owner, symbol, _tokenName, _swarmHash, now); } /** * @notice Change the expiry time for the token symbol * @param _newExpiry new time period for token symbol expiry */ function changeExpiryLimit(uint256 _newExpiry) public onlyOwner { require(_newExpiry >= 1 days, "Expiry should greater than or equal to 1 day"); uint256 _oldExpiry = expiryLimit; expiryLimit = _newExpiry; emit LogChangeExpiryLimit(_oldExpiry, _newExpiry); } /** * @notice Check the validity of the symbol * @param _symbol token symbol * @param _owner address of the owner * @param _tokenName Name of the token * @return bool */ function checkValidity(string _symbol, address _owner, string _tokenName) public returns(bool) { string memory symbol = upper(_symbol); require(msg.sender == securityTokenRegistry, "msg.sender should be SecurityTokenRegistry contract"); require(registeredSymbols[symbol].status != true, "Symbol status should not equal to true"); require(registeredSymbols[symbol].owner == _owner, "Owner of the symbol should matched with the requested issuer address"); require(registeredSymbols[symbol].timestamp.add(expiryLimit) >= now, "Ticker should not be expired"); registeredSymbols[symbol].tokenName = _tokenName; registeredSymbols[symbol].status = true; return true; } /** * @notice Check the symbol is reserved or not * @param _symbol Symbol of the token * @param _owner Owner of the token * @param _tokenName Name of the token * @param _swarmHash off-chain hash * @return bool */ function isReserved(string _symbol, address _owner, string _tokenName, bytes32 _swarmHash) public returns(bool) { string memory symbol = upper(_symbol); require(msg.sender == securityTokenRegistry, "msg.sender should be SecurityTokenRegistry contract"); if (registeredSymbols[symbol].owner == _owner && !expiryCheck(_symbol)) { registeredSymbols[symbol].status = true; return false; } else if (registeredSymbols[symbol].owner == address(0) || expiryCheck(symbol)) { registeredSymbols[symbol] = SymbolDetails(_owner, now, _tokenName, _swarmHash, true); emit LogRegisterTicker (_owner, symbol, _tokenName, _swarmHash, now); return false; } else return true; } /** * @notice Returns the owner and timestamp for a given symbol * @param _symbol symbol * @return address * @return uint256 * @return string * @return bytes32 * @return bool */ function getDetails(string _symbol) public view returns (address, uint256, string, bytes32, bool) { string memory symbol = upper(_symbol); if (registeredSymbols[symbol].status == true||registeredSymbols[symbol].timestamp.add(expiryLimit) > now) { return ( registeredSymbols[symbol].owner, registeredSymbols[symbol].timestamp, registeredSymbols[symbol].tokenName, registeredSymbols[symbol].swarmHash, registeredSymbols[symbol].status ); }else return (address(0), uint256(0), "", bytes32(0), false); } /** * @notice To re-initialize the token symbol details if symbol validity expires * @param _symbol token symbol * @return bool */ function expiryCheck(string _symbol) internal returns(bool) { if (registeredSymbols[_symbol].owner != address(0)) { if (now > registeredSymbols[_symbol].timestamp.add(expiryLimit) && registeredSymbols[_symbol].status != true) { registeredSymbols[_symbol] = SymbolDetails(address(0), uint256(0), "", bytes32(0), false); return true; }else return false; } return true; } /** * @notice set the ticker registration fee in POLY tokens * @param _registrationFee registration fee in POLY tokens (base 18 decimals) */ function changePolyRegisterationFee(uint256 _registrationFee) public onlyOwner { require(registrationFee != _registrationFee); emit LogChangePolyRegisterationFee(registrationFee, _registrationFee); registrationFee = _registrationFee; } /** * @notice pause registration function */ function unpause() public onlyOwner { _unpause(); } /** * @notice unpause registration function */ function pause() public onlyOwner { _pause(); } }
/** * @title Registry contract for issuers to reserve their security token symbols * @notice Allows issuers to reserve their token symbols ahead of actually generating their security token. * @dev SecurityTokenRegistry would reference this contract and ensure that a token symbol exists here and only its owner can deploy the token with that symbol. */
NatSpecMultiLine
checkValidity
function checkValidity(string _symbol, address _owner, string _tokenName) public returns(bool) { string memory symbol = upper(_symbol); require(msg.sender == securityTokenRegistry, "msg.sender should be SecurityTokenRegistry contract"); require(registeredSymbols[symbol].status != true, "Symbol status should not equal to true"); require(registeredSymbols[symbol].owner == _owner, "Owner of the symbol should matched with the requested issuer address"); require(registeredSymbols[symbol].timestamp.add(expiryLimit) >= now, "Ticker should not be expired"); registeredSymbols[symbol].tokenName = _tokenName; registeredSymbols[symbol].status = true; return true; }
/** * @notice Check the validity of the symbol * @param _symbol token symbol * @param _owner address of the owner * @param _tokenName Name of the token * @return bool */
NatSpecMultiLine
v0.4.24+commit.e67f0147
bzzr://1c3fd67e0e5dae16f4d5818e4def156aa71b9a6925640af36a76c616a54e724c
{ "func_code_index": [ 3308, 4051 ] }
5,799