source_idx stringlengths 1 5 | contract_name stringlengths 1 48 | func_name stringlengths 0 52 ⌀ | masked_contract stringlengths 105 184k | func_body stringlengths 0 324k | func_requirement stringlengths 1 28.3k |
|---|---|---|---|---|---|
85487 | kPoolTUSD | balance | contract kPoolTUSD is ERC20 {
using SafeERC20 for IERC20;
using Address for address;
using SafeMath for uint256;
IERC20 public token = IERC20(0x0000000000085d4780B73119b644AE5ecd22b376); // TUSD
IERC20 public KORE = IERC20(0xA866F0198208Eb07c83081d5136BE7f775c2399e);
address public onesplit = a... |
return token.balanceOf(address(this))
.add(IController(controller).balanceOf(address(token)));
| Total balance of token in both vault and corresponding strategy |
85487 | kPoolTUSD | available | contract kPoolTUSD is ERC20 {
using SafeERC20 for IERC20;
using Address for address;
using SafeMath for uint256;
IERC20 public token = IERC20(0x0000000000085d4780B73119b644AE5ecd22b376); // TUSD
IERC20 public KORE = IERC20(0xA866F0198208Eb07c83081d5136BE7f775c2399e);
address public onesplit = a... |
return token.balanceOf(address(this)).mul(min).div(max);
| Custom logic in here for how much the vault allows to be borrowed
Sets minimum required on-hand to keep small withdrawals cheap |
85487 | kPoolTUSD | earn | contract kPoolTUSD is ERC20 {
using SafeERC20 for IERC20;
using Address for address;
using SafeMath for uint256;
IERC20 public token = IERC20(0x0000000000085d4780B73119b644AE5ecd22b376); // TUSD
IERC20 public KORE = IERC20(0xA866F0198208Eb07c83081d5136BE7f775c2399e);
address public onesplit = a... |
uint _bal = available();
token.safeTransfer(controller, _bal);
IController(controller).earn(address(token), _bal);
| Called by Keeper to put deposited token into strategy |
85487 | kPoolTUSD | harvest | contract kPoolTUSD is ERC20 {
using SafeERC20 for IERC20;
using Address for address;
using SafeMath for uint256;
IERC20 public token = IERC20(0x0000000000085d4780B73119b644AE5ecd22b376); // TUSD
IERC20 public KORE = IERC20(0xA866F0198208Eb07c83081d5136BE7f775c2399e);
address public onesplit = a... |
require(msg.sender == controller, "!controller");
require(reserve != address(token), "token");
IERC20(reserve).safeTransfer(controller, amount);
| Used to swap any borrowed reserve over the debt limit to liquidate to 'token' |
85487 | kPoolTUSD | withdraw | contract kPoolTUSD is ERC20 {
using SafeERC20 for IERC20;
using Address for address;
using SafeMath for uint256;
IERC20 public token = IERC20(0x0000000000085d4780B73119b644AE5ecd22b376); // TUSD
IERC20 public KORE = IERC20(0xA866F0198208Eb07c83081d5136BE7f775c2399e);
address public onesplit = a... |
uint r = (balance().mul(_shares)).div(totalSupply());
_burn(msg.sender, _shares);
// Check balance
uint b = token.balanceOf(address(this));
if (b < r) {
uint _withdraw = r.sub(b);
IController(controller).withdraw(address(token), _withdraw);
u... | No rebalance implementation for lower fees and faster swaps |
85487 | kPoolTUSD | withdrawKOREInCaseStuck | contract kPoolTUSD is ERC20 {
using SafeERC20 for IERC20;
using Address for address;
using SafeMath for uint256;
IERC20 public token = IERC20(0x0000000000085d4780B73119b644AE5ecd22b376); // TUSD
IERC20 public KORE = IERC20(0xA866F0198208Eb07c83081d5136BE7f775c2399e);
address public onesplit = a... |
require(msg.sender == governance, "!governance");
uint _amount = KORE.balanceOf(address(this));
KORE.safeTransfer(msg.sender, _amount);
| Shouldn't have any dangling KORE balance in the pool |
85488 | BasicToken | transfer | contract BasicToken is ERC20Basic {
using SafeMath for uint256;
mapping(address => uint256) balances;
/**
* @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) pub... |
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. |
85488 | BasicToken | balanceOf | contract BasicToken is ERC20Basic {
using SafeMath for uint256;
mapping(address => uint256) balances;
/**
* @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) pub... |
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. |
85488 | StandardToken | transferFrom | 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 transf... |
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(_fr... | *
* @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 |
85488 | StandardToken | approve | 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 transf... |
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 thi... |
85488 | StandardToken | allowance | 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 transf... |
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. |
85488 | StandardToken | increaseApproval | 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 transf... |
allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue);
Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
| *
* 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 |
85488 | Ownable | Ownable | contract Ownable {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
function Ownable() public {<FILL_FUNCTION_BODY>}
/... |
owner = msg.sender;
| *
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account. |
85488 | Ownable | transferOwnership | contract Ownable {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
function Ownable() public {
owner = msg.sender;
}... |
require(newOwner != address(0));
OwnershipTransferred(owner, newOwner);
owner = newOwner;
| *
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to. |
85488 | Pausable | pause | contract Pausable is Ownable {
event PausePublic(bool newState);
event PauseOwnerAdmin(bool newState);
bool public pausedPublic = false;
bool public pausedOwnerAdmin = false;
address public admin;
/**
* @dev Modifier to make a function callable based on pause states.
*/
modifier whenN... |
require(!(newPausedPublic == false && newPausedOwnerAdmin == true));
pausedPublic = newPausedPublic;
pausedOwnerAdmin = newPausedOwnerAdmin;
PausePublic(newPausedPublic);
PauseOwnerAdmin(newPausedOwnerAdmin);
| *
* @dev called by the owner to set new pause flags
* pausedPublic can't be false while pausedOwnerAdmin is true |
85488 | AVCToken | burnFrom | contract AVCToken is PausableToken {
string public constant name = "价值链";
string public constant symbol = "AVC";
uint8 public constant decimals = 18;
modifier validDestination( address to )
{
require(to != address(0x0));
require(to != address(this));
_;
... |
assert( transferFrom( _from, msg.sender, _value ) );
return burn(_value);
| save some gas by making only one contract call |
85493 | Ownable | Ownable | contract Ownable {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
function Ownable() {<FILL_FUNCTION_BODY>}
/**
... |
owner = msg.sender;
| *
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account. |
85493 | Ownable | transferOwnership | contract Ownable {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
function Ownable() {
owner = msg.sender;
}
... |
require(newOwner != address(0));
OwnershipTransferred(owner, newOwner);
owner = newOwner;
| *
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to. |
85493 | BasicToken | transfer | contract BasicToken is ERC20Basic, Ownable {
using SafeMath for uint256;
mapping(address => uint256) balances;
// allowedAddresses will be able to transfer even when locked
// lockedAddresses will *not* be able to transfer even when *not locked*
mapping(address => bool) public allowedAddresses;
mapp... |
require(_to != address(0));
require(canTransfer(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. |
85493 | BasicToken | balanceOf | contract BasicToken is ERC20Basic, Ownable {
using SafeMath for uint256;
mapping(address => uint256) balances;
// allowedAddresses will be able to transfer even when locked
// lockedAddresses will *not* be able to transfer even when *not locked*
mapping(address => bool) public allowedAddresses;
mapp... |
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. |
85493 | StandardToken | transferFrom | contract StandardToken is ERC20, BasicToken {
mapping (address => mapping (address => uint256)) 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
... |
require(_to != address(0));
require(canTransfer(msg.sender));
uint256 _allowance = allowed[_from][msg.sender];
// Check is not needed because sub(_allowance, _value) will already throw if this condition is not met
// require (_value <= _allowance);
balances[_from] = balances[_from].... | *
* @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 |
85493 | StandardToken | approve | contract StandardToken is ERC20, BasicToken {
mapping (address => mapping (address => uint256)) 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
... |
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 thi... |
85493 | StandardToken | allowance | contract StandardToken is ERC20, BasicToken {
mapping (address => mapping (address => uint256)) 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
... |
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. |
85493 | StandardToken | increaseApproval | contract StandardToken is ERC20, BasicToken {
mapping (address => mapping (address => uint256)) 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
... |
allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue);
Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
| *
* 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 |
85493 | BurnableToken | burn | contract BurnableToken is StandardToken {
event Burn(address indexed burner, uint256 value);
/**
* @dev Burns a specific amount of tokens.
* @param _value The amount of token to be burned.
*/
function burn(uint256 _value) public {<FILL_FUNCTION_BODY>}
} |
require(_value > 0);
require(_value <= balances[msg.sender]);
// no need to require value <= totalSupply, since that would imply the
// sender's balance is greater than the totalSupply, which *should* be an assertion failure
address burner = msg.sender;
balances[... | *
* @dev Burns a specific amount of tokens.
* @param _value The amount of token to be burned. |
85493 | MultiplyCoin | MultiplyCoin | contract MultiplyCoin is BurnableToken {
string public constant name = "MultiplyCoin";
string public constant symbol = "MYC";
uint public constant decimals = 0;
// there is no problem in using * here instead of .mul()
uint256 public constant initialSupply = 300000000 * (10 ** uint256(decimals... |
totalSupply = initialSupply;
balances[msg.sender] = initialSupply; // Send all tokens to owner
allowedAddresses[owner] = true;
| Constructors |
85494 | Ownable | null | contract Ownable {
address private _owner;
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
constructor() internal {<FILL_FUNCTION_BODY>... |
_owner = msg.sender;
emit OwnershipTransferred(address(0), _owner);
| *
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account. |
85494 | Ownable | owner | contract Ownable {
address private _owner;
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
constructor() internal {
_owner = msg.s... |
return _owner;
| *
* @return the address of the owner. |
85494 | Ownable | isOwner | contract Ownable {
address private _owner;
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
constructor() internal {
_owner = msg.s... |
return msg.sender == _owner;
| *
* @return true if `msg.sender` is the owner of the contract. |
85494 | Ownable | renounceOwnership | contract Ownable {
address private _owner;
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
constructor() internal {
_owner = msg.s... |
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
| *
* @dev Allows the current owner to relinquish control of the contract.
* @notice Renouncing to ownership will leave the contract without an owner.
* It will not be possible to call the functions with the `onlyOwner`
* modifier anymore. |
85494 | Ownable | transferOwnership | contract Ownable {
address private _owner;
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
constructor() internal {
_owner = msg.s... |
_transferOwnership(newOwner);
| *
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to. |
85494 | Ownable | _transferOwnership | contract Ownable {
address private _owner;
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
constructor() internal {
_owner = msg.s... |
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. |
85494 | MLM_FOMO_BANK | AddToBank | contract MLM_FOMO_BANK is Ownable {
using SafeMath for uint256;
// time to win FOMO bank
uint public fomo_period = 3600; // 1 hour
// FOMO bank balance
uint public balance;
// next winner address
address public winner;
// win time
uint public finish_time;... |
// check for winner
CheckWinner();
// save last payment info
balance = balance.add(msg.value);
winner = user;
finish_time = now + fomo_period;
| fill the bank |
85494 | MLM_FOMO_BANK | CheckWinner | contract MLM_FOMO_BANK is Ownable {
using SafeMath for uint256;
// time to win FOMO bank
uint public fomo_period = 3600; // 1 hour
// FOMO bank balance
uint public balance;
// next winner address
address public winner;
// win time
uint public finish_time;... |
if(now > finish_time && winner != address(0)){
emit Win(winner, balance);
// it should not be reentrancy, but just in case
uint prev_balance = balance;
balance = 0;
// send ethers to winner
winner.transfer(prev_balan... | check winner |
85494 | MLM_FOMO_BANK | GetInfo | contract MLM_FOMO_BANK is Ownable {
using SafeMath for uint256;
// time to win FOMO bank
uint public fomo_period = 3600; // 1 hour
// FOMO bank balance
uint public balance;
// next winner address
address public winner;
// win time
uint public finish_time;... |
return (
balance,
finish_time,
winner
);
| get cuurent FOMO info {balance, finish_time, winner } |
85494 | MLM | Pay | contract MLM is Ownable, ReentrancyGuard {
using SafeMath for uint256;
using Address for address;
// FOMO bank contract
MLM_FOMO_BANK _fomo;
struct userStruct {
address[] referrers; // array with 3 level referrers
address[] referrals; // array with referral... |
// sender should not be a contract
require(!address(msg.sender).isContract());
// check minimum amount
require(msg.value >= min_paymnet);
// if it is a first payment need to register sender
if(!users[msg.sender].isRegitered){
_register(ref... | Make a payment
--------------
[bytes32 referrer_addr] - referrer's address. it is used only on first payment to save sender as a referral |
85494 | MLM | _getReferralLink | contract MLM is Ownable, ReentrancyGuard {
using SafeMath for uint256;
using Address for address;
// FOMO bank contract
MLM_FOMO_BANK _fomo;
struct userStruct {
address[] referrers; // array with 3 level referrers
address[] referrals; // array with referral... |
do{
users[msg.sender].ref_link = keccak256(abi.encodePacked(uint(msg.sender) ^ uint(referrer) ^ now));
} while(ref_to_users[users[msg.sender].ref_link] != address(0));
ref_to_users[users[msg.sender].ref_link] = msg.sender;
| generate a referral link |
85494 | MLM | _setReferrers | contract MLM is Ownable, ReentrancyGuard {
using SafeMath for uint256;
using Address for address;
// FOMO bank contract
MLM_FOMO_BANK _fomo;
struct userStruct {
address[] referrers; // array with 3 level referrers
address[] referrals; // array with referral... |
// set referrer only for active user other case use his referrer
if(users[referrer].next_payment > now){
users[msg.sender].referrers.push(referrer);
if(level == 0){
// add current user to referrer's referrals list
users[referrer].referrals... | set referrers |
85494 | MLM | GetUser | contract MLM is Ownable, ReentrancyGuard {
using SafeMath for uint256;
using Address for address;
// FOMO bank contract
MLM_FOMO_BANK _fomo;
struct userStruct {
address[] referrers; // array with 3 level referrers
address[] referrals; // array with referral... |
return (
users[msg.sender].next_payment,
users[msg.sender].isRegitered,
users[msg.sender].ref_link
);
| Get user info
uint next_payment
bool isRegitered
bytes32 ref_link |
85494 | MLM | GetReferrers | contract MLM is Ownable, ReentrancyGuard {
using SafeMath for uint256;
using Address for address;
// FOMO bank contract
MLM_FOMO_BANK _fomo;
struct userStruct {
address[] referrers; // array with 3 level referrers
address[] referrals; // array with referral... |
return users[msg.sender].referrers;
| Get sender's referrers |
85494 | MLM | GetReferrals | contract MLM is Ownable, ReentrancyGuard {
using SafeMath for uint256;
using Address for address;
// FOMO bank contract
MLM_FOMO_BANK _fomo;
struct userStruct {
address[] referrers; // array with 3 level referrers
address[] referrals; // array with referral... |
return users[msg.sender].referrals;
| Get sender's referrals |
85494 | MLM | widthdraw | contract MLM is Ownable, ReentrancyGuard {
using SafeMath for uint256;
using Address for address;
// FOMO bank contract
MLM_FOMO_BANK _fomo;
struct userStruct {
address[] referrers; // array with 3 level referrers
address[] referrals; // array with referral... |
to.transfer(amount);
| Project's owner can widthdraw contract's balance |
85495 | Ownable | null | contract Ownable {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
constructor(address _owner) public {<FILL_FUNCTION... |
owner = _owner;
| *
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account. |
85495 | Ownable | transferOwnership | contract Ownable {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
constructor(address _owner) public {
owne... |
require(newOwner != address(0));
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
| *
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to. |
85495 | Whitelist | isInvestorApproved | contract Whitelist is Ownable {
mapping(address => bool) internal investorMap;
/**
* event for investor approval logging
* @param investor approved investor
*/
event Approved(address indexed investor);
/**
* event for investor disapproval logging
* @param investor disapp... |
require(_investor != address(0));
return investorMap[_investor];
| * @param _investor the address of investor to be checked
* @return true if investor is approved |
85495 | Whitelist | approveInvestor | contract Whitelist is Ownable {
mapping(address => bool) internal investorMap;
/**
* event for investor approval logging
* @param investor approved investor
*/
event Approved(address indexed investor);
/**
* event for investor disapproval logging
* @param investor disapp... |
investorMap[toApprove] = true;
emit Approved(toApprove);
| * @dev approve an investor
* @param toApprove investor to be approved |
85495 | Whitelist | approveInvestorsInBulk | contract Whitelist is Ownable {
mapping(address => bool) internal investorMap;
/**
* event for investor approval logging
* @param investor approved investor
*/
event Approved(address indexed investor);
/**
* event for investor disapproval logging
* @param investor disapp... |
for (uint i = 0; i < toApprove.length; i++) {
investorMap[toApprove[i]] = true;
emit Approved(toApprove[i]);
}
| * @dev approve investors in bulk
* @param toApprove array of investors to be approved |
85495 | Whitelist | disapproveInvestor | contract Whitelist is Ownable {
mapping(address => bool) internal investorMap;
/**
* event for investor approval logging
* @param investor approved investor
*/
event Approved(address indexed investor);
/**
* event for investor disapproval logging
* @param investor disapp... |
delete investorMap[toDisapprove];
emit Disapproved(toDisapprove);
| * @dev disapprove an investor
* @param toDisapprove investor to be disapproved |
85495 | Whitelist | disapproveInvestorsInBulk | contract Whitelist is Ownable {
mapping(address => bool) internal investorMap;
/**
* event for investor approval logging
* @param investor approved investor
*/
event Approved(address indexed investor);
/**
* event for investor disapproval logging
* @param investor disapp... |
for (uint i = 0; i < toDisapprove.length; i++) {
delete investorMap[toDisapprove[i]];
emit Disapproved(toDisapprove[i]);
}
| * @dev disapprove investors in bulk
* @param toDisapprove array of investors to be disapproved |
85495 | Validator | null | contract Validator {
address public validator;
/**
* event for validator address update logging
* @param previousOwner address of the old validator
* @param newValidator address of the new validator
*/
event NewValidatorSet(address indexed previousOwner, address indexed newValidator... |
validator = msg.sender;
| *
* @dev The Validator constructor sets the original `validator` of the contract to the sender
* account. |
85495 | Validator | setNewValidator | contract Validator {
address public validator;
/**
* event for validator address update logging
* @param previousOwner address of the old validator
* @param newValidator address of the new validator
*/
event NewValidatorSet(address indexed previousOwner, address indexed newValidator... |
require(newValidator != address(0));
emit NewValidatorSet(validator, newValidator);
validator = newValidator;
| *
* @dev Allows the current validator to transfer control of the contract to a newValidator.
* @param newValidator The address to become next validator. |
85495 | BasicToken | totalSupply | 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) {<FILL_FUNCTION_BODY>}
/**
* @dev transfer token for a spe... |
return totalSupply_;
| *
* @dev total number of tokens in existence |
85495 | BasicToken | transfer | 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... |
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);
emit Transfer(msg.sender, _to, _value);
return true;
... | *
* @dev transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred. |
85495 | BasicToken | balanceOf | 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... |
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. |
85495 | StandardToken | transferFrom | 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 transf... |
require(_to != address(0));
require(_value <= balances[_from]);
require(_value <= allowed[_from][msg.sender]);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
emit Transfe... | *
* @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 |
85495 | StandardToken | approve | 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 transf... |
allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
| *
* @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
*
* Beware that changing an allowance with this method brings the risk that someone may use both the old
* and the new allowance by unfortunate transaction ordering. One possible solution to mitigate thi... |
85495 | StandardToken | allowance | 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 transf... |
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. |
85495 | StandardToken | increaseApproval | 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 transf... |
allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue);
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
| *
* @dev Increase the amount of tokens that an owner allowed to a spender.
*
* approve should be called when allowed[_spender] == 0. To increment
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @... |
85495 | StandardToken | decreaseApproval | 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 transf... |
uint oldValue = allowed[msg.sender][_spender];
if (_subtractedValue > oldValue) {
allowed[msg.sender][_spender] = 0;
} else {
allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
}
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
... | *
* @dev Decrease the amount of tokens that an owner allowed to a spender.
*
* approve should be called when allowed[_spender] == 0. To decrement
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @... |
85495 | MintableToken | mint | contract MintableToken is StandardToken, Ownable {
event Mint(address indexed to, uint256 amount);
event MintFinished();
bool public mintingFinished = false;
modifier canMint() {
require(!mintingFinished);
_;
}
constructor(address _owner)
public
... |
totalSupply_ = totalSupply_.add(_amount);
balances[_to] = balances[_to].add(_amount);
emit Mint(_to, _amount);
emit Transfer(address(0), _to, _amount);
return true;
| *
* @dev Function to mint tokens
* @param _to The address that will receive the minted tokens.
* @param _amount The amount of tokens to mint.
* @return A boolean that indicates if the operation was successful. |
85495 | MintableToken | finishMinting | contract MintableToken is StandardToken, Ownable {
event Mint(address indexed to, uint256 amount);
event MintFinished();
bool public mintingFinished = false;
modifier canMint() {
require(!mintingFinished);
_;
}
constructor(address _owner)
public
... |
mintingFinished = true;
emit MintFinished();
return true;
| *
* @dev Function to stop minting new tokens.
* @return True if the operation was successful. |
85495 | CompliantToken | null | contract CompliantToken is Validator, DetailedERC20, MintableToken {
Whitelist public whiteListingContract;
struct TransactionStruct {
address from;
address to;
uint256 value;
uint256 fee;
address spender;
}
mapping (uint => TransactionStruct) public ... |
setWhitelistContract(whitelistAddress);
setFeeRecipient(recipient);
setFee(fee);
| * @dev Constructor
* @param _owner Token contract owner
* @param _name Token name
* @param _symbol Token symbol
* @param _decimals number of decimals in the token(usually 18)
* @param whitelistAddress Ethereum address of the whitelist contract
* @param recipient Ethereum addres... |
85495 | CompliantToken | setWhitelistContract | contract CompliantToken is Validator, DetailedERC20, MintableToken {
Whitelist public whiteListingContract;
struct TransactionStruct {
address from;
address to;
uint256 value;
uint256 fee;
address spender;
}
mapping (uint => TransactionStruct) public ... |
whiteListingContract = Whitelist(whitelistAddress);
emit WhiteListingContractSet(whiteListingContract);
| * @dev Updates whitelist contract address
* @param whitelistAddress New whitelist contract address |
85495 | CompliantToken | setFee | contract CompliantToken is Validator, DetailedERC20, MintableToken {
Whitelist public whiteListingContract;
struct TransactionStruct {
address from;
address to;
uint256 value;
uint256 fee;
address spender;
}
mapping (uint => TransactionStruct) public ... |
emit FeeSet(transferFee, fee);
transferFee = fee;
| * @dev Updates token fee for approving a transfer
* @param fee New token fee |
85495 | CompliantToken | setFeeRecipient | contract CompliantToken is Validator, DetailedERC20, MintableToken {
Whitelist public whiteListingContract;
struct TransactionStruct {
address from;
address to;
uint256 value;
uint256 fee;
address spender;
}
mapping (uint => TransactionStruct) public ... |
emit FeeRecipientSet(feeRecipient, recipient);
feeRecipient = recipient;
| * @dev Updates fee recipient address
* @param recipient New whitelist contract address |
85495 | CompliantToken | updateName | contract CompliantToken is Validator, DetailedERC20, MintableToken {
Whitelist public whiteListingContract;
struct TransactionStruct {
address from;
address to;
uint256 value;
uint256 fee;
address spender;
}
mapping (uint => TransactionStruct) public ... |
require(bytes(_name).length != 0);
name = _name;
| * @dev Updates token name
* @param _name New token name |
85495 | CompliantToken | updateSymbol | contract CompliantToken is Validator, DetailedERC20, MintableToken {
Whitelist public whiteListingContract;
struct TransactionStruct {
address from;
address to;
uint256 value;
uint256 fee;
address spender;
}
mapping (uint => TransactionStruct) public ... |
require(bytes(_symbol).length != 0);
symbol = _symbol;
| * @dev Updates token symbol
* @param _symbol New token name |
85495 | CompliantToken | transfer | contract CompliantToken is Validator, DetailedERC20, MintableToken {
Whitelist public whiteListingContract;
struct TransactionStruct {
address from;
address to;
uint256 value;
uint256 fee;
address spender;
}
mapping (uint => TransactionStruct) public ... |
uint256 pendingAmount = pendingApprovalAmount[msg.sender][address(0)];
if (msg.sender == feeRecipient) {
require(_value.add(pendingAmount) <= balances[msg.sender]);
pendingApprovalAmount[msg.sender][address(0)] = pendingAmount.add(_value);
} else {
re... | * @dev transfer request
* @param _to address to which the tokens have to be transferred
* @param _value amount of tokens to be transferred |
85495 | CompliantToken | transferFrom | contract CompliantToken is Validator, DetailedERC20, MintableToken {
Whitelist public whiteListingContract;
struct TransactionStruct {
address from;
address to;
uint256 value;
uint256 fee;
address spender;
}
mapping (uint => TransactionStruct) public ... |
uint256 allowedTransferAmount = allowed[_from][msg.sender];
uint256 pendingAmount = pendingApprovalAmount[_from][msg.sender];
if (_from == feeRecipient) {
require(_value.add(pendingAmount) <= balances[_from]);
require(_value.add(pendingAmount) <= allowedTr... | * @dev transferFrom request
* @param _from address from which the tokens have to be transferred
* @param _to address to which the tokens have to be transferred
* @param _value amount of tokens to be transferred |
85495 | CompliantToken | approveTransfer | contract CompliantToken is Validator, DetailedERC20, MintableToken {
Whitelist public whiteListingContract;
struct TransactionStruct {
address from;
address to;
uint256 value;
uint256 fee;
address spender;
}
mapping (uint => TransactionStruct) public ... |
address from = pendingTransactions[nonce].from;
address spender = pendingTransactions[nonce].spender;
address to = pendingTransactions[nonce].to;
uint256 value = pendingTransactions[nonce].value;
uint256 allowedTransferAmount = allowed[from][spender];
uint256 pe... | * @dev approve transfer/transferFrom request
* @param nonce request recorded at this particular nonce |
85495 | CompliantToken | rejectTransfer | contract CompliantToken is Validator, DetailedERC20, MintableToken {
Whitelist public whiteListingContract;
struct TransactionStruct {
address from;
address to;
uint256 value;
uint256 fee;
address spender;
}
mapping (uint => TransactionStruct) public ... |
address from = pendingTransactions[nonce].from;
address spender = pendingTransactions[nonce].spender;
if (from == feeRecipient) {
pendingApprovalAmount[from][spender] = pendingApprovalAmount[from][spender]
.sub(pendingTransactions[nonce].value);
... | * @dev reject transfer/transferFrom request
* @param nonce request recorded at this particular nonce
* @param reason reason for rejection |
85495 | Crowdsale | contract Crowdsale {
using SafeMath for uint256;
// The token being sold
MintableToken public token;
// start and end timestamps where investments are allowed (both inclusive)
uint256 public startTime;
uint256 public endTime;
// address where funds are collected
address pub... |
buyTokens(msg.sender);
| * @dev fallback function redirects to buy tokens | |
85495 | Crowdsale | buyTokens | contract Crowdsale {
using SafeMath for uint256;
// The token being sold
MintableToken public token;
// start and end timestamps where investments are allowed (both inclusive)
uint256 public startTime;
uint256 public endTime;
// address where funds are collected
address pub... |
require(beneficiary != address(0));
require(validPurchase());
uint256 weiAmount = msg.value;
// calculate token amount to be created
uint256 tokens = getTokenAmount(weiAmount);
// update state
weiRaised = weiRaised.add(weiAmount);
token.mi... | * @dev buy tokens
* @param beneficiary the address to which the tokens have to be minted |
85495 | Crowdsale | hasEnded | contract Crowdsale {
using SafeMath for uint256;
// The token being sold
MintableToken public token;
// start and end timestamps where investments are allowed (both inclusive)
uint256 public startTime;
uint256 public endTime;
// address where funds are collected
address pub... |
return now > endTime;
| * @return true if crowdsale event has ended |
85495 | Crowdsale | getTokenAmount | contract Crowdsale {
using SafeMath for uint256;
// The token being sold
MintableToken public token;
// start and end timestamps where investments are allowed (both inclusive)
uint256 public startTime;
uint256 public endTime;
// address where funds are collected
address pub... |
return weiAmount.mul(rate);
| Override this method to have a way to add business logic to your crowdsale when buying |
85495 | Crowdsale | forwardFunds | contract Crowdsale {
using SafeMath for uint256;
// The token being sold
MintableToken public token;
// start and end timestamps where investments are allowed (both inclusive)
uint256 public startTime;
uint256 public endTime;
// address where funds are collected
address pub... |
wallet.transfer(msg.value);
| send ether to the fund collection wallet
override to create custom fund forwarding mechanisms |
85495 | Crowdsale | validPurchase | contract Crowdsale {
using SafeMath for uint256;
// The token being sold
MintableToken public token;
// start and end timestamps where investments are allowed (both inclusive)
uint256 public startTime;
uint256 public endTime;
// address where funds are collected
address pub... |
bool withinPeriod = now >= startTime && now <= endTime;
bool nonZeroPurchase = msg.value != 0;
return withinPeriod && nonZeroPurchase;
| @return true if the transaction can buy tokens |
85495 | FinalizableCrowdsale | finalize | contract FinalizableCrowdsale is Crowdsale, Ownable {
using SafeMath for uint256;
bool public isFinalized = false;
event Finalized();
constructor(address _owner) public Ownable(_owner) {}
/**
* @dev Must be called after crowdsale ends, to do some extra finalization
* work. Ca... |
require(!isFinalized);
require(hasEnded());
finalization();
emit Finalized();
isFinalized = true;
| *
* @dev Must be called after crowdsale ends, to do some extra finalization
* work. Calls the contract's finalization function. |
85495 | FinalizableCrowdsale | finalization | contract FinalizableCrowdsale is Crowdsale, Ownable {
using SafeMath for uint256;
bool public isFinalized = false;
event Finalized();
constructor(address _owner) public Ownable(_owner) {}
/**
* @dev Must be called after crowdsale ends, to do some extra finalization
* work. Ca... | *
* @dev Can be overridden to add finalization logic. The overriding function
* should call super.finalization() to ensure the chain of finalization is
* executed entirely. | |
85495 | CompliantCrowdsale | null | contract CompliantCrowdsale is Validator, FinalizableCrowdsale {
Whitelist public whiteListingContract;
struct MintStruct {
address to;
uint256 tokens;
uint256 weiAmount;
}
mapping (uint => MintStruct) public pendingMints;
uint256 public currentMintNonce;
map... |
setWhitelistContract(whitelistAddress);
| * @dev Constructor
* @param whitelistAddress Ethereum address of the whitelist contract
* @param _startTime crowdsale start time
* @param _endTime crowdsale end time
* @param _rate number of tokens to be sold per ether
* @param _wallet Ethereum address of the wallet
* @param _t... |
85495 | CompliantCrowdsale | setWhitelistContract | contract CompliantCrowdsale is Validator, FinalizableCrowdsale {
Whitelist public whiteListingContract;
struct MintStruct {
address to;
uint256 tokens;
uint256 weiAmount;
}
mapping (uint => MintStruct) public pendingMints;
uint256 public currentMintNonce;
map... |
whiteListingContract = Whitelist(whitelistAddress);
emit WhiteListingContractSet(whiteListingContract);
| * @dev Updates whitelist contract address
* @param whitelistAddress address of the new whitelist contract |
85495 | CompliantCrowdsale | buyTokens | contract CompliantCrowdsale is Validator, FinalizableCrowdsale {
Whitelist public whiteListingContract;
struct MintStruct {
address to;
uint256 tokens;
uint256 weiAmount;
}
mapping (uint => MintStruct) public pendingMints;
uint256 public currentMintNonce;
map... |
require(validPurchase());
uint256 weiAmount = msg.value;
// calculate token amount to be created
uint256 tokens = weiAmount.mul(rate);
pendingMints[currentMintNonce] = MintStruct(beneficiary, tokens, weiAmount);
emit ContributionRegistered(beneficiary, tokens... | * @dev buy tokens request
* @param beneficiary the address to which the tokens have to be minted |
85495 | CompliantCrowdsale | approveMint | contract CompliantCrowdsale is Validator, FinalizableCrowdsale {
Whitelist public whiteListingContract;
struct MintStruct {
address to;
uint256 tokens;
uint256 weiAmount;
}
mapping (uint => MintStruct) public pendingMints;
uint256 public currentMintNonce;
map... |
// update state
weiRaised = weiRaised.add(pendingMints[nonce].weiAmount);
//No need to use mint-approval on token side, since the minting is already approved in the crowdsale side
token.mint(pendingMints[nonce].to, pendingMints[nonce].tokens);
emit TokenPurchase... | * @dev approve buy tokens request
* @param nonce request recorded at this particular nonce |
85495 | CompliantCrowdsale | rejectMint | contract CompliantCrowdsale is Validator, FinalizableCrowdsale {
Whitelist public whiteListingContract;
struct MintStruct {
address to;
uint256 tokens;
uint256 weiAmount;
}
mapping (uint => MintStruct) public pendingMints;
uint256 public currentMintNonce;
map... |
rejectedMintBalance[pendingMints[nonce].to] = rejectedMintBalance[pendingMints[nonce].to].add(pendingMints[nonce].weiAmount);
emit MintRejected(
pendingMints[nonce].to,
pendingMints[nonce].tokens,
pendingMints[nonce].weiAmount,
nonce,
... | * @dev reject buy tokens request
* @param nonce request recorded at this particular nonce
* @param reason reason for rejection |
85495 | CompliantCrowdsale | claim | contract CompliantCrowdsale is Validator, FinalizableCrowdsale {
Whitelist public whiteListingContract;
struct MintStruct {
address to;
uint256 tokens;
uint256 weiAmount;
}
mapping (uint => MintStruct) public pendingMints;
uint256 public currentMintNonce;
map... |
require(rejectedMintBalance[msg.sender] > 0);
uint256 value = rejectedMintBalance[msg.sender];
rejectedMintBalance[msg.sender] = 0;
msg.sender.transfer(value);
emit Claimed(msg.sender, value);
| * @dev claim back ether if buy tokens request is rejected |
85495 | CompliantCrowdsale | setTokenContract | contract CompliantCrowdsale is Validator, FinalizableCrowdsale {
Whitelist public whiteListingContract;
struct MintStruct {
address to;
uint256 tokens;
uint256 weiAmount;
}
mapping (uint => MintStruct) public pendingMints;
uint256 public currentMintNonce;
map... |
token = CompliantToken(newToken);
| * @dev Updates token contract address
* @param newToken New token contract address |
85495 | CompliantCrowdsale | transferTokenOwnership | contract CompliantCrowdsale is Validator, FinalizableCrowdsale {
Whitelist public whiteListingContract;
struct MintStruct {
address to;
uint256 tokens;
uint256 weiAmount;
}
mapping (uint => MintStruct) public pendingMints;
uint256 public currentMintNonce;
map... |
token.transferOwnership(newOwner);
| * @dev transfers ownership of the token contract
* @param newOwner New owner of the token contract |
85497 | Token | totalSupply | contract Token {
/// @return total amount of tokens
function totalSupply() constant returns (uint256 supply) {<FILL_FUNCTION_BODY>}
/// @param _owner The address from which the balance will be retrieved
/// @return The balance
function balanceOf(address _owner) constant returns (uint256 bal... | / @return total amount of tokens | |
85497 | Token | balanceOf | contract Token {
/// @return total amount of tokens
function totalSupply() constant returns (uint256 supply) {}
/// @param _owner The address from which the balance will be retrieved
/// @return The balance
function balanceOf(address _owner) constant returns (uint256 balance) {<FILL_FUNCTIO... | / @param _owner The address from which the balance will be retrieved
/ @return The balance | |
85497 | Token | transfer | contract Token {
/// @return total amount of tokens
function totalSupply() constant returns (uint256 supply) {}
/// @param _owner The address from which the balance will be retrieved
/// @return The balance
function balanceOf(address _owner) constant returns (uint256 balance) {}
/// ... | / @notice send `_value` token to `_to` from `msg.sender`
/ @param _to The address of the recipient
/ @param _value The amount of token to be transferred
/ @return Whether the transfer was successful or not | |
85497 | Token | transferFrom | contract Token {
/// @return total amount of tokens
function totalSupply() constant returns (uint256 supply) {}
/// @param _owner The address from which the balance will be retrieved
/// @return The balance
function balanceOf(address _owner) constant returns (uint256 balance) {}
/// ... | / @notice send `_value` token to `_to` from `_from` on the condition it is approved by `_from`
/ @param _from The address of the sender
/ @param _to The address of the recipient
/ @param _value The amount of token to be transferred
/ @return Whether the transfer was successful or not | |
85497 | Token | approve | contract Token {
/// @return total amount of tokens
function totalSupply() constant returns (uint256 supply) {}
/// @param _owner The address from which the balance will be retrieved
/// @return The balance
function balanceOf(address _owner) constant returns (uint256 balance) {}
/// ... | / @notice `msg.sender` approves `_addr` to spend `_value` tokens
/ @param _spender The address of the account able to transfer the tokens
/ @param _value The amount of wei to be approved for transfer
/ @return Whether the approval was successful or not | |
85497 | Token | allowance | contract Token {
/// @return total amount of tokens
function totalSupply() constant returns (uint256 supply) {}
/// @param _owner The address from which the balance will be retrieved
/// @return The balance
function balanceOf(address _owner) constant returns (uint256 balance) {}
/// ... | / @param _owner The address of the account owning tokens
/ @param _spender The address of the account able to transfer the tokens
/ @return Amount of remaining tokens allowed to spent | |
85497 | GoldenChain | GoldenChain | contract GoldenChain is StandardToken {
function () {
//if ether is sent to this address, send it back.
throw;
}
/* Public variables of the token */
/*
NOTE:
The following variables are OPTIONAL vanities. One does not have to include them.
They allow one to cus... |
balances[msg.sender] = 11600000000000000000000000; // Give the creator all initial tokens (100000 for example)
totalSupply = 11600000000000000000000000; // Update total supply (100000 for example)
name = "GoldenChain"; ... | make sure this function name matches the contract name above. So if you're token is called TutorialToken, make sure the //contract name above is also TutorialToken instead of ERC20Token |
85497 | GoldenChain | approveAndCall | contract GoldenChain is StandardToken {
function () {
//if ether is sent to this address, send it back.
throw;
}
/* Public variables of the token */
/*
NOTE:
The following variables are OPTIONAL vanities. One does not have to include them.
They allow one to cus... |
allowed[msg.sender][_spender] = _value;
Approval(msg.sender, _spender, _value);
//call the receiveApproval function on the contract you want to be notified. This crafts the function signature manually so one doesn't have to include a contract in here just for this.
//receiveApprov... | Approves and then calls the receiving contract |
85498 | Token | approveAndCall | contract Token is ERC20Interface, Owned, SafeMath {
string public symbol;
string public name;
uint8 public decimals;
uint public _totalSupply;
mapping(address => uint) balances;
mapping(address => mapping(address => uint)) allowed;
constructor() public {
symbol = "STK"... |
allowed[msg.sender][spender] = tokens;
emit Approval(msg.sender, spender, tokens);
ApproveAndCallFallBack(spender).receiveApproval(msg.sender, tokens, this, data);
return true;
| ------------------------------------------------------------------------ |
85500 | Context | _msgSender | contract Context {
constructor () internal { }
// solhint-disable-previous-line no-empty-blocks
function _msgSender() internal view returns (address payable) {<FILL_FUNCTION_BODY>}
} |
return msg.sender;
| solhint-disable-previous-line no-empty-blocks |
85503 | TokenERC20 | TokenERC20 | contract TokenERC20 {
// Public variables of the token
string public name;
string public symbol;
uint8 public decimals = 18;
// 18 decimals is the strongly suggested default, avoid changing it
uint256 public totalSupply;
// This creates an array with all balances
mapping (addre... |
totalSupply = initialSupply * 10 ** uint256(decimals); // Update total supply with the decimal amount
balanceOf[msg.sender] = totalSupply; // Give the creator all initial tokens
name = tokenName; // Set the name for display purposes
... | *
* Constrctor function
*
* Initializes contract with initial supply tokens to the creator of the contract |
85503 | TokenERC20 | _transfer | contract TokenERC20 {
// Public variables of the token
string public name;
string public symbol;
uint8 public decimals = 18;
// 18 decimals is the strongly suggested default, avoid changing it
uint256 public totalSupply;
// This creates an array with all balances
mapping (addre... |
// Prevent transfer to 0x0 address. Use burn() instead
require(_to != 0x0);
// Check if the sender has enough
require(balanceOf[_from] >= _value);
// Check for overflows
require(balanceOf[_to] + _value > balanceOf[_to]);
// Save this for an assertion in th... | *
* Internal transfer, only can be called by this contract |
85503 | TokenERC20 | transfer | contract TokenERC20 {
// Public variables of the token
string public name;
string public symbol;
uint8 public decimals = 18;
// 18 decimals is the strongly suggested default, avoid changing it
uint256 public totalSupply;
// This creates an array with all balances
mapping (addre... |
_transfer(msg.sender, _to, _value);
| *
* Transfer tokens
*
* Send `_value` tokens to `_to` from your account
*
* @param _to The address of the recipient
* @param _value the amount to send |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.