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
RtcTokenCrowdsale
RtcTokenCrowdsale.sol
0xa988a5808f8b839fe65ec75fd5d5a005b59a466d
Solidity
RtcTokenCrowdsale
contract RtcTokenCrowdsale is Ownable, AddressWhitelist { using SafeMath for uint256; PausableToken public tokenReward; // address of the token used as reward // deployment variables for static supply sale uint256 public initialSupply; uint256 public tokensRemaining; uint256 public decimals; // multi-sig addresses and price variable address public beneficiaryWallet; // beneficiaryMultiSig (founder group) or wallet account uint256 public tokensPerEthPrice; // set initial value floating priceVar 10,000 tokens per Eth // uint256 values for min,max,caps,tracking uint256 public amountRaisedInWei; uint256 public fundingMinCapInWei; // pricing veriable uint256 public p1_duration; uint256 public p1_start; uint256 public p2_start; uint256 public white_duration; // loop control, ICO startup and limiters uint256 public fundingStartTime; // crowdsale start time# uint256 public fundingEndTime; // crowdsale end time# bool public isCrowdSaleClosed = false; // crowdsale completion boolean bool public areFundsReleasedToBeneficiary = false; // boolean for founder to receive Eth or not bool public isCrowdSaleSetup = false; // boolean for crowdsale setup // Gas price limit uint256 maxGasPrice = 50000000000; event Buy(address indexed _sender, uint256 _eth, uint256 _RTC); event Refund(address indexed _refunder, uint256 _value); mapping(address => uint256) fundValue; // convert tokens to decimals function toSmallrtc(uint256 amount) public constant returns (uint256) { return amount.mul(10**decimals); } // convert tokens to whole function toRtc(uint256 amount) public constant returns (uint256) { return amount.div(10**decimals); } function updateMaxGasPrice(uint256 _newGasPrice) public onlyOwner { require(_newGasPrice != 0); maxGasPrice = _newGasPrice; } // setup the CrowdSale parameters function setupCrowdsale(uint256 _fundingStartTime) external onlyOwner { if ((!(isCrowdSaleSetup)) && (!(beneficiaryWallet > 0))){ // init addresses tokenReward = PausableToken(0xdb75BFC1ad984c5CeefA8Ec6394596e20d789034); beneficiaryWallet = 0xf07bd63C5cf404c2f17ab4F9FA1e13fCCEbc5255; tokensPerEthPrice = 10000; // 1 ETH = 10,000 RTC // funding targets fundingMinCapInWei = 350 ether; //350 Eth (min cap) (test = 15) - crowdsale is considered success after this value // update values decimals = 18; amountRaisedInWei = 0; initialSupply = toSmallrtc(35000000); // 35 million * 18 decimal tokensRemaining = initialSupply; fundingStartTime = _fundingStartTime; white_duration = 2 weeks; // 2 week (test = 2 hour) p1_duration = 4 weeks; // 4 week (test = 2 hour) p1_start = fundingStartTime + white_duration; p2_start = p1_start + p1_duration + 4 weeks; // + 4 week after p1 ends (test = 4 hour) fundingEndTime = p2_start + 4 weeks; // + 4 week (test = 4 hour) // configure crowdsale isCrowdSaleSetup = true; isCrowdSaleClosed = false; } } function setBonusPrice() public constant returns (uint256 bonus) { require(isCrowdSaleSetup); require(p1_start + p1_duration <= p2_start); if (now >= fundingStartTime && now <= p1_start) { // Private sale Bonus 40% = 4,000 RTC = 1 ETH bonus = 4000; } else if (now > p1_start && now <= p1_start + p1_duration) { // Phase-1 Bonus 30% = 3,000 RTC = 1 ETH bonus = 3000; } else if (now > p2_start && now <= p2_start + 1 days ) { // Phase-2 1st day Bonus 25% = 2,500 RTC = 1 ETH bonus = 2500; } else if (now > p2_start + 1 days && now <= p2_start + 1 weeks ) { // Phase-2 week-1 Bonus 20% = 2,000 RTC = 1 ETH bonus = 2000; } else if (now > p2_start + 1 weeks && now <= p2_start + 2 weeks ) { // Phase-2 week-2 Bonus +15% = 1,500 RTC = 1 ETH bonus = 1500; } else if (now > p2_start + 2 weeks && now <= p2_start + 3 weeks ) { // Phase-2 week-3 Bonus +10% = 1,000 RTC = 1 ETH bonus = 1000; } else if (now > p2_start + 3 weeks && now <= fundingEndTime ) { // Phase-2 final week Bonus 5% = 500 RTC = 1 ETH bonus = 500; } else { revert(); } } // p1_duration constant. Only p2 start changes. p2 start cannot be greater than 1 month from p1 end function updateDuration(uint256 _newP2Start) external onlyOwner { // function to update the duration of phase-1 and adjust the start time of phase-2 require(isCrowdSaleSetup && !(p2_start == _newP2Start) && !(_newP2Start > p1_start + p1_duration + 30 days) && (now < p2_start) && (fundingStartTime + p1_duration < _newP2Start)); p2_start = _newP2Start; fundingEndTime = p2_start.add(4 weeks); // 4 week } // default payable function when sending ether to this contract function () external payable { require(tx.gasprice <= maxGasPrice); require(msg.data.length == 0); BuyRTCtokens(); } function BuyRTCtokens() public payable { // conditions (length, crowdsale setup, zero check, exceed funding contrib check, contract valid check, within funding block range check, balance overflow check etc) require(!(msg.value == 0) && (isCrowdSaleSetup) && (now >= fundingStartTime) && (now <= fundingEndTime) && (tokensRemaining > 0)); // only whitelisted addresses are allowed during the first day of phase 1 if (now <= p1_start) { assert(isWhitelisted(msg.sender)); } uint256 rewardTransferAmount = 0; uint256 rewardBaseTransferAmount = 0; uint256 rewardBonusTransferAmount = 0; uint256 contributionInWei = msg.value; uint256 refundInWei = 0; rewardBonusTransferAmount = setBonusPrice(); rewardBaseTransferAmount = (msg.value.mul(tokensPerEthPrice)); // Since both ether and RTC have 18 decimals, No need of conversion rewardBonusTransferAmount = (msg.value.mul(rewardBonusTransferAmount)); // Since both ether and RTC have 18 decimals, No need of conversion rewardTransferAmount = rewardBaseTransferAmount.add(rewardBonusTransferAmount); if (rewardTransferAmount > tokensRemaining) { uint256 partialPercentage; partialPercentage = tokensRemaining.mul(10**18).div(rewardTransferAmount); contributionInWei = contributionInWei.mul(partialPercentage).div(10**18); rewardBonusTransferAmount = rewardBonusTransferAmount.mul(partialPercentage).div(10**18); rewardTransferAmount = tokensRemaining; refundInWei = msg.value.sub(contributionInWei); } amountRaisedInWei = amountRaisedInWei.add(contributionInWei); tokensRemaining = tokensRemaining.sub(rewardTransferAmount); // will cause throw if attempt to purchase over the token limit in one tx or at all once limit reached fundValue[msg.sender] = fundValue[msg.sender].add(contributionInWei); assert(tokenReward.increaseFrozen(msg.sender, rewardBonusTransferAmount)); tokenReward.transfer(msg.sender, rewardTransferAmount); Buy(msg.sender, contributionInWei, rewardTransferAmount); if (refundInWei > 0) { msg.sender.transfer(refundInWei); } } function beneficiaryMultiSigWithdraw() external onlyOwner { checkGoalReached(); require(areFundsReleasedToBeneficiary && (amountRaisedInWei >= fundingMinCapInWei)); beneficiaryWallet.transfer(this.balance); } function checkGoalReached() public returns (bytes32 response) { // return crowdfund status to owner for each result case, update public constant // update state & status variables require (isCrowdSaleSetup); if ((amountRaisedInWei < fundingMinCapInWei) && (block.timestamp <= fundingEndTime && block.timestamp >= fundingStartTime)) { // ICO in progress, under softcap areFundsReleasedToBeneficiary = false; isCrowdSaleClosed = false; return "In progress (Eth < Softcap)"; } else if ((amountRaisedInWei < fundingMinCapInWei) && (block.timestamp < fundingStartTime)) { // ICO has not started areFundsReleasedToBeneficiary = false; isCrowdSaleClosed = false; return "Crowdsale is setup"; } else if ((amountRaisedInWei < fundingMinCapInWei) && (block.timestamp > fundingEndTime)) { // ICO ended, under softcap areFundsReleasedToBeneficiary = false; isCrowdSaleClosed = true; return "Unsuccessful (Eth < Softcap)"; } else if ((amountRaisedInWei >= fundingMinCapInWei) && (tokensRemaining == 0)) { // ICO ended, all tokens gone areFundsReleasedToBeneficiary = true; isCrowdSaleClosed = true; return "Successful (RTC >= Hardcap)!"; } else if ((amountRaisedInWei >= fundingMinCapInWei) && (block.timestamp > fundingEndTime) && (tokensRemaining > 0)) { // ICO ended, over softcap! areFundsReleasedToBeneficiary = true; isCrowdSaleClosed = true; return "Successful (Eth >= Softcap)!"; } else if ((amountRaisedInWei >= fundingMinCapInWei) && (tokensRemaining > 0) && (block.timestamp <= fundingEndTime)) { // ICO in progress, over softcap! areFundsReleasedToBeneficiary = true; isCrowdSaleClosed = false; return "In progress (Eth >= Softcap)!"; } } function refund() external { // any contributor can call this to have their Eth returned. user's purchased RTC tokens are burned prior refund of Eth. checkGoalReached(); //require minCap not reached require ((amountRaisedInWei < fundingMinCapInWei) && (isCrowdSaleClosed) && (now > fundingEndTime) && (fundValue[msg.sender] > 0)); //refund Eth sent uint256 ethRefund = fundValue[msg.sender]; fundValue[msg.sender] = 0; //send Eth back, burn tokens msg.sender.transfer(ethRefund); Refund(msg.sender, ethRefund); } function burnRemainingTokens() onlyOwner external { require(now > fundingEndTime); uint256 tokensToBurn = tokenReward.balanceOf(this); tokenReward.burn(tokensToBurn); } }
function () external payable { require(tx.gasprice <= maxGasPrice); require(msg.data.length == 0); BuyRTCtokens(); }
// default payable function when sending ether to this contract
LineComment
v0.4.19+commit.c4cbbb05
bzzr://6091d92f92cb7d01520dabfffd71b0b6515f4e34d31943f44fa093d8d215feaa
{ "func_code_index": [ 6008, 6171 ] }
1,007
Deposit
Deposit.sol
0xbec4fd72b3d1f81767505cd820865f181bce1afa
Solidity
Ownable
abstract contract Ownable { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor () { address msgSender = msg.sender; _owner = msgSender; emit OwnershipTransferred(address(0), msgSender); } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(owner() == msg.sender, "Ownable: caller is not the owner"); _; } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { emit OwnershipTransferred(_owner, address(0)); _owner = address(0); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { require(newOwner != address(0), "Ownable: new owner is the zero address"); emit OwnershipTransferred(_owner, newOwner); _owner = newOwner; } }
owner
function owner() public view virtual returns (address) { return _owner; }
/** * @dev Returns the address of the current owner. */
NatSpecMultiLine
v0.8.4+commit.c7e474f2
None
ipfs://3e6b7f3d0745bc501b5664c4b8f8525d01c1eba7dddb6ff72f038c2cf1fbc2f9
{ "func_code_index": [ 484, 576 ] }
1,008
Deposit
Deposit.sol
0xbec4fd72b3d1f81767505cd820865f181bce1afa
Solidity
Ownable
abstract contract Ownable { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor () { address msgSender = msg.sender; _owner = msgSender; emit OwnershipTransferred(address(0), msgSender); } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(owner() == msg.sender, "Ownable: caller is not the owner"); _; } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { emit OwnershipTransferred(_owner, address(0)); _owner = address(0); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { require(newOwner != address(0), "Ownable: new owner is the zero address"); emit OwnershipTransferred(_owner, newOwner); _owner = newOwner; } }
renounceOwnership
function renounceOwnership() public virtual onlyOwner { emit OwnershipTransferred(_owner, address(0)); _owner = address(0); }
/** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */
NatSpecMultiLine
v0.8.4+commit.c7e474f2
None
ipfs://3e6b7f3d0745bc501b5664c4b8f8525d01c1eba7dddb6ff72f038c2cf1fbc2f9
{ "func_code_index": [ 1133, 1286 ] }
1,009
Deposit
Deposit.sol
0xbec4fd72b3d1f81767505cd820865f181bce1afa
Solidity
Ownable
abstract contract Ownable { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor () { address msgSender = msg.sender; _owner = msgSender; emit OwnershipTransferred(address(0), msgSender); } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(owner() == msg.sender, "Ownable: caller is not the owner"); _; } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { emit OwnershipTransferred(_owner, address(0)); _owner = address(0); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { require(newOwner != address(0), "Ownable: new owner is the zero address"); emit OwnershipTransferred(_owner, newOwner); _owner = newOwner; } }
transferOwnership
function transferOwnership(address newOwner) public virtual onlyOwner { require(newOwner != address(0), "Ownable: new owner is the zero address"); emit OwnershipTransferred(_owner, newOwner); _owner = newOwner; }
/** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */
NatSpecMultiLine
v0.8.4+commit.c7e474f2
None
ipfs://3e6b7f3d0745bc501b5664c4b8f8525d01c1eba7dddb6ff72f038c2cf1fbc2f9
{ "func_code_index": [ 1436, 1685 ] }
1,010
Deposit
Deposit.sol
0xbec4fd72b3d1f81767505cd820865f181bce1afa
Solidity
Deposit
contract Deposit is Ownable{ ERC20 public fungibleContract; uint256 public erc20TokenValue = 34 * 10 ** 16; uint256 public depositLimit = 10* 10**18; address public erc20AdminAddress; mapping (address => bool) public depositedMap; event DepositSuccess(address addr, uint256 value); constructor(){} receive() external payable { require(msg.value == erc20TokenValue, "not integer token"); require(!depositedMap[msg.sender], "recharged"); require(fungibleContract.transferFrom(erc20AdminAddress, msg.sender, depositLimit), "transfer erc20 token failed"); depositedMap[msg.sender] = true; emit DepositSuccess(msg.sender, depositLimit); } function setERC20Address(address _address) external onlyOwner { fungibleContract = ERC20(_address); } function setERC20TokenValueCount(uint256 _wei, uint256 _limit) external onlyOwner { erc20TokenValue = _wei; depositLimit = _limit; } // function setDepositLimit(uint256 _limit) public onlyOwner{ // depositLimit = _limit; // } function setERC20AdminAddress(address _address) external onlyOwner { erc20AdminAddress = _address; } function withdrawBalance(address payable _address) external onlyOwner { uint256 balance = address(this).balance; _address.transfer(balance); } }
setERC20AdminAddress
function setERC20AdminAddress(address _address) external onlyOwner { erc20AdminAddress = _address; }
// function setDepositLimit(uint256 _limit) public onlyOwner{ // depositLimit = _limit; // }
LineComment
v0.8.4+commit.c7e474f2
None
ipfs://3e6b7f3d0745bc501b5664c4b8f8525d01c1eba7dddb6ff72f038c2cf1fbc2f9
{ "func_code_index": [ 1144, 1263 ] }
1,011
ChowChow
ChowChow.sol
0x795cd42ca45ee99398f8e3ae87c6c87c43183627
Solidity
IERC20
interface IERC20 { function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `recipient`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address recipient, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `sender` to `recipient` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom(address sender, address recipient, uint256 amount) external returns (bool); /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); }
balanceOf
function balanceOf(address account) external view returns (uint256);
/** * @dev Returns the amount of tokens owned by `account`. */
NatSpecMultiLine
v0.6.12+commit.27d51765
None
ipfs://dc2ef5f183a3408ddfd271dfdddd9f9ea17de1f5c07a47614436fba036f0931b
{ "func_code_index": [ 165, 238 ] }
1,012
ChowChow
ChowChow.sol
0x795cd42ca45ee99398f8e3ae87c6c87c43183627
Solidity
IERC20
interface IERC20 { function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `recipient`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address recipient, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `sender` to `recipient` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom(address sender, address recipient, uint256 amount) external returns (bool); /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); }
transfer
function transfer(address recipient, uint256 amount) external returns (bool);
/** * @dev Moves `amount` tokens from the caller's account to `recipient`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */
NatSpecMultiLine
v0.6.12+commit.27d51765
None
ipfs://dc2ef5f183a3408ddfd271dfdddd9f9ea17de1f5c07a47614436fba036f0931b
{ "func_code_index": [ 462, 544 ] }
1,013
ChowChow
ChowChow.sol
0x795cd42ca45ee99398f8e3ae87c6c87c43183627
Solidity
IERC20
interface IERC20 { function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `recipient`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address recipient, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `sender` to `recipient` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom(address sender, address recipient, uint256 amount) external returns (bool); /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); }
allowance
function allowance(address owner, address spender) external view returns (uint256);
/** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */
NatSpecMultiLine
v0.6.12+commit.27d51765
None
ipfs://dc2ef5f183a3408ddfd271dfdddd9f9ea17de1f5c07a47614436fba036f0931b
{ "func_code_index": [ 823, 911 ] }
1,014
ChowChow
ChowChow.sol
0x795cd42ca45ee99398f8e3ae87c6c87c43183627
Solidity
IERC20
interface IERC20 { function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `recipient`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address recipient, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `sender` to `recipient` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom(address sender, address recipient, uint256 amount) external returns (bool); /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); }
approve
function approve(address spender, uint256 amount) external returns (bool);
/** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */
NatSpecMultiLine
v0.6.12+commit.27d51765
None
ipfs://dc2ef5f183a3408ddfd271dfdddd9f9ea17de1f5c07a47614436fba036f0931b
{ "func_code_index": [ 1575, 1654 ] }
1,015
ChowChow
ChowChow.sol
0x795cd42ca45ee99398f8e3ae87c6c87c43183627
Solidity
IERC20
interface IERC20 { function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `recipient`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address recipient, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `sender` to `recipient` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom(address sender, address recipient, uint256 amount) external returns (bool); /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); }
transferFrom
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
/** * @dev Moves `amount` tokens from `sender` to `recipient` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */
NatSpecMultiLine
v0.6.12+commit.27d51765
None
ipfs://dc2ef5f183a3408ddfd271dfdddd9f9ea17de1f5c07a47614436fba036f0931b
{ "func_code_index": [ 1967, 2069 ] }
1,016
ChowChow
ChowChow.sol
0x795cd42ca45ee99398f8e3ae87c6c87c43183627
Solidity
SafeMath
library SafeMath { /** * @dev Returns the addition of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `+` operator. * * Requirements: * * - Addition cannot overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; require(c >= a, "SafeMath: addition overflow"); return c; } /** * @dev Returns the subtraction of two unsigned integers, reverting on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { return sub(a, b, "SafeMath: subtraction overflow"); } /** * @dev Returns the subtraction of two unsigned integers, reverting with custom message on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b <= a, errorMessage); uint256 c = a - b; return c; } /** * @dev Returns the multiplication of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `*` operator. * * Requirements: * * - Multiplication cannot overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522 if (a == 0) { return 0; } uint256 c = a * b; require(c / a == b, "SafeMath: multiplication overflow"); return c; } /** * @dev Returns the integer division of two unsigned integers. Reverts on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { return div(a, b, "SafeMath: division by zero"); } /** * @dev Returns the integer division of two unsigned integers. Reverts with custom message on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b > 0, errorMessage); uint256 c = a / b; // assert(a == b * c + a % b); // There is no case in which this doesn't hold return c; } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * Reverts when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b) internal pure returns (uint256) { return mod(a, b, "SafeMath: modulo by zero"); } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * Reverts with custom message when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b != 0, errorMessage); return a % b; } }
/** * @dev Wrappers over Solidity's arithmetic operations with added overflow * checks. * * Arithmetic operations in Solidity wrap on overflow. This can easily result * in bugs, because programmers usually assume that an overflow raises an * error, which is the standard behavior in high level programming languages. * `SafeMath` restores this intuition by reverting the transaction when an * operation overflows. * * Using this library instead of the unchecked operations eliminates an entire * class of bugs, so it's recommended to use it always. */
NatSpecMultiLine
add
function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; require(c >= a, "SafeMath: addition overflow"); return c; }
/** * @dev Returns the addition of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `+` operator. * * Requirements: * * - Addition cannot overflow. */
NatSpecMultiLine
v0.6.12+commit.27d51765
None
ipfs://dc2ef5f183a3408ddfd271dfdddd9f9ea17de1f5c07a47614436fba036f0931b
{ "func_code_index": [ 259, 445 ] }
1,017
ChowChow
ChowChow.sol
0x795cd42ca45ee99398f8e3ae87c6c87c43183627
Solidity
SafeMath
library SafeMath { /** * @dev Returns the addition of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `+` operator. * * Requirements: * * - Addition cannot overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; require(c >= a, "SafeMath: addition overflow"); return c; } /** * @dev Returns the subtraction of two unsigned integers, reverting on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { return sub(a, b, "SafeMath: subtraction overflow"); } /** * @dev Returns the subtraction of two unsigned integers, reverting with custom message on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b <= a, errorMessage); uint256 c = a - b; return c; } /** * @dev Returns the multiplication of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `*` operator. * * Requirements: * * - Multiplication cannot overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522 if (a == 0) { return 0; } uint256 c = a * b; require(c / a == b, "SafeMath: multiplication overflow"); return c; } /** * @dev Returns the integer division of two unsigned integers. Reverts on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { return div(a, b, "SafeMath: division by zero"); } /** * @dev Returns the integer division of two unsigned integers. Reverts with custom message on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b > 0, errorMessage); uint256 c = a / b; // assert(a == b * c + a % b); // There is no case in which this doesn't hold return c; } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * Reverts when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b) internal pure returns (uint256) { return mod(a, b, "SafeMath: modulo by zero"); } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * Reverts with custom message when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b != 0, errorMessage); return a % b; } }
/** * @dev Wrappers over Solidity's arithmetic operations with added overflow * checks. * * Arithmetic operations in Solidity wrap on overflow. This can easily result * in bugs, because programmers usually assume that an overflow raises an * error, which is the standard behavior in high level programming languages. * `SafeMath` restores this intuition by reverting the transaction when an * operation overflows. * * Using this library instead of the unchecked operations eliminates an entire * class of bugs, so it's recommended to use it always. */
NatSpecMultiLine
sub
function sub(uint256 a, uint256 b) internal pure returns (uint256) { return sub(a, b, "SafeMath: subtraction overflow"); }
/** * @dev Returns the subtraction of two unsigned integers, reverting on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */
NatSpecMultiLine
v0.6.12+commit.27d51765
None
ipfs://dc2ef5f183a3408ddfd271dfdddd9f9ea17de1f5c07a47614436fba036f0931b
{ "func_code_index": [ 723, 864 ] }
1,018
ChowChow
ChowChow.sol
0x795cd42ca45ee99398f8e3ae87c6c87c43183627
Solidity
SafeMath
library SafeMath { /** * @dev Returns the addition of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `+` operator. * * Requirements: * * - Addition cannot overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; require(c >= a, "SafeMath: addition overflow"); return c; } /** * @dev Returns the subtraction of two unsigned integers, reverting on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { return sub(a, b, "SafeMath: subtraction overflow"); } /** * @dev Returns the subtraction of two unsigned integers, reverting with custom message on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b <= a, errorMessage); uint256 c = a - b; return c; } /** * @dev Returns the multiplication of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `*` operator. * * Requirements: * * - Multiplication cannot overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522 if (a == 0) { return 0; } uint256 c = a * b; require(c / a == b, "SafeMath: multiplication overflow"); return c; } /** * @dev Returns the integer division of two unsigned integers. Reverts on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { return div(a, b, "SafeMath: division by zero"); } /** * @dev Returns the integer division of two unsigned integers. Reverts with custom message on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b > 0, errorMessage); uint256 c = a / b; // assert(a == b * c + a % b); // There is no case in which this doesn't hold return c; } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * Reverts when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b) internal pure returns (uint256) { return mod(a, b, "SafeMath: modulo by zero"); } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * Reverts with custom message when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b != 0, errorMessage); return a % b; } }
/** * @dev Wrappers over Solidity's arithmetic operations with added overflow * checks. * * Arithmetic operations in Solidity wrap on overflow. This can easily result * in bugs, because programmers usually assume that an overflow raises an * error, which is the standard behavior in high level programming languages. * `SafeMath` restores this intuition by reverting the transaction when an * operation overflows. * * Using this library instead of the unchecked operations eliminates an entire * class of bugs, so it's recommended to use it always. */
NatSpecMultiLine
sub
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b <= a, errorMessage); uint256 c = a - b; return c; }
/** * @dev Returns the subtraction of two unsigned integers, reverting with custom message on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */
NatSpecMultiLine
v0.6.12+commit.27d51765
None
ipfs://dc2ef5f183a3408ddfd271dfdddd9f9ea17de1f5c07a47614436fba036f0931b
{ "func_code_index": [ 1162, 1359 ] }
1,019
ChowChow
ChowChow.sol
0x795cd42ca45ee99398f8e3ae87c6c87c43183627
Solidity
SafeMath
library SafeMath { /** * @dev Returns the addition of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `+` operator. * * Requirements: * * - Addition cannot overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; require(c >= a, "SafeMath: addition overflow"); return c; } /** * @dev Returns the subtraction of two unsigned integers, reverting on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { return sub(a, b, "SafeMath: subtraction overflow"); } /** * @dev Returns the subtraction of two unsigned integers, reverting with custom message on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b <= a, errorMessage); uint256 c = a - b; return c; } /** * @dev Returns the multiplication of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `*` operator. * * Requirements: * * - Multiplication cannot overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522 if (a == 0) { return 0; } uint256 c = a * b; require(c / a == b, "SafeMath: multiplication overflow"); return c; } /** * @dev Returns the integer division of two unsigned integers. Reverts on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { return div(a, b, "SafeMath: division by zero"); } /** * @dev Returns the integer division of two unsigned integers. Reverts with custom message on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b > 0, errorMessage); uint256 c = a / b; // assert(a == b * c + a % b); // There is no case in which this doesn't hold return c; } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * Reverts when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b) internal pure returns (uint256) { return mod(a, b, "SafeMath: modulo by zero"); } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * Reverts with custom message when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b != 0, errorMessage); return a % b; } }
/** * @dev Wrappers over Solidity's arithmetic operations with added overflow * checks. * * Arithmetic operations in Solidity wrap on overflow. This can easily result * in bugs, because programmers usually assume that an overflow raises an * error, which is the standard behavior in high level programming languages. * `SafeMath` restores this intuition by reverting the transaction when an * operation overflows. * * Using this library instead of the unchecked operations eliminates an entire * class of bugs, so it's recommended to use it always. */
NatSpecMultiLine
mul
function mul(uint256 a, uint256 b) internal pure returns (uint256) { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522 if (a == 0) { return 0; } uint256 c = a * b; require(c / a == b, "SafeMath: multiplication overflow"); return c; }
/** * @dev Returns the multiplication of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `*` operator. * * Requirements: * * - Multiplication cannot overflow. */
NatSpecMultiLine
v0.6.12+commit.27d51765
None
ipfs://dc2ef5f183a3408ddfd271dfdddd9f9ea17de1f5c07a47614436fba036f0931b
{ "func_code_index": [ 1613, 2089 ] }
1,020
ChowChow
ChowChow.sol
0x795cd42ca45ee99398f8e3ae87c6c87c43183627
Solidity
SafeMath
library SafeMath { /** * @dev Returns the addition of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `+` operator. * * Requirements: * * - Addition cannot overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; require(c >= a, "SafeMath: addition overflow"); return c; } /** * @dev Returns the subtraction of two unsigned integers, reverting on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { return sub(a, b, "SafeMath: subtraction overflow"); } /** * @dev Returns the subtraction of two unsigned integers, reverting with custom message on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b <= a, errorMessage); uint256 c = a - b; return c; } /** * @dev Returns the multiplication of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `*` operator. * * Requirements: * * - Multiplication cannot overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522 if (a == 0) { return 0; } uint256 c = a * b; require(c / a == b, "SafeMath: multiplication overflow"); return c; } /** * @dev Returns the integer division of two unsigned integers. Reverts on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { return div(a, b, "SafeMath: division by zero"); } /** * @dev Returns the integer division of two unsigned integers. Reverts with custom message on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b > 0, errorMessage); uint256 c = a / b; // assert(a == b * c + a % b); // There is no case in which this doesn't hold return c; } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * Reverts when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b) internal pure returns (uint256) { return mod(a, b, "SafeMath: modulo by zero"); } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * Reverts with custom message when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b != 0, errorMessage); return a % b; } }
/** * @dev Wrappers over Solidity's arithmetic operations with added overflow * checks. * * Arithmetic operations in Solidity wrap on overflow. This can easily result * in bugs, because programmers usually assume that an overflow raises an * error, which is the standard behavior in high level programming languages. * `SafeMath` restores this intuition by reverting the transaction when an * operation overflows. * * Using this library instead of the unchecked operations eliminates an entire * class of bugs, so it's recommended to use it always. */
NatSpecMultiLine
div
function div(uint256 a, uint256 b) internal pure returns (uint256) { return div(a, b, "SafeMath: division by zero"); }
/** * @dev Returns the integer division of two unsigned integers. Reverts on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */
NatSpecMultiLine
v0.6.12+commit.27d51765
None
ipfs://dc2ef5f183a3408ddfd271dfdddd9f9ea17de1f5c07a47614436fba036f0931b
{ "func_code_index": [ 2560, 2697 ] }
1,021
ChowChow
ChowChow.sol
0x795cd42ca45ee99398f8e3ae87c6c87c43183627
Solidity
SafeMath
library SafeMath { /** * @dev Returns the addition of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `+` operator. * * Requirements: * * - Addition cannot overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; require(c >= a, "SafeMath: addition overflow"); return c; } /** * @dev Returns the subtraction of two unsigned integers, reverting on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { return sub(a, b, "SafeMath: subtraction overflow"); } /** * @dev Returns the subtraction of two unsigned integers, reverting with custom message on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b <= a, errorMessage); uint256 c = a - b; return c; } /** * @dev Returns the multiplication of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `*` operator. * * Requirements: * * - Multiplication cannot overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522 if (a == 0) { return 0; } uint256 c = a * b; require(c / a == b, "SafeMath: multiplication overflow"); return c; } /** * @dev Returns the integer division of two unsigned integers. Reverts on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { return div(a, b, "SafeMath: division by zero"); } /** * @dev Returns the integer division of two unsigned integers. Reverts with custom message on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b > 0, errorMessage); uint256 c = a / b; // assert(a == b * c + a % b); // There is no case in which this doesn't hold return c; } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * Reverts when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b) internal pure returns (uint256) { return mod(a, b, "SafeMath: modulo by zero"); } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * Reverts with custom message when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b != 0, errorMessage); return a % b; } }
/** * @dev Wrappers over Solidity's arithmetic operations with added overflow * checks. * * Arithmetic operations in Solidity wrap on overflow. This can easily result * in bugs, because programmers usually assume that an overflow raises an * error, which is the standard behavior in high level programming languages. * `SafeMath` restores this intuition by reverting the transaction when an * operation overflows. * * Using this library instead of the unchecked operations eliminates an entire * class of bugs, so it's recommended to use it always. */
NatSpecMultiLine
div
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b > 0, errorMessage); uint256 c = a / b; // assert(a == b * c + a % b); // There is no case in which this doesn't hold return c; }
/** * @dev Returns the integer division of two unsigned integers. Reverts with custom message on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */
NatSpecMultiLine
v0.6.12+commit.27d51765
None
ipfs://dc2ef5f183a3408ddfd271dfdddd9f9ea17de1f5c07a47614436fba036f0931b
{ "func_code_index": [ 3188, 3471 ] }
1,022
ChowChow
ChowChow.sol
0x795cd42ca45ee99398f8e3ae87c6c87c43183627
Solidity
SafeMath
library SafeMath { /** * @dev Returns the addition of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `+` operator. * * Requirements: * * - Addition cannot overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; require(c >= a, "SafeMath: addition overflow"); return c; } /** * @dev Returns the subtraction of two unsigned integers, reverting on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { return sub(a, b, "SafeMath: subtraction overflow"); } /** * @dev Returns the subtraction of two unsigned integers, reverting with custom message on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b <= a, errorMessage); uint256 c = a - b; return c; } /** * @dev Returns the multiplication of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `*` operator. * * Requirements: * * - Multiplication cannot overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522 if (a == 0) { return 0; } uint256 c = a * b; require(c / a == b, "SafeMath: multiplication overflow"); return c; } /** * @dev Returns the integer division of two unsigned integers. Reverts on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { return div(a, b, "SafeMath: division by zero"); } /** * @dev Returns the integer division of two unsigned integers. Reverts with custom message on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b > 0, errorMessage); uint256 c = a / b; // assert(a == b * c + a % b); // There is no case in which this doesn't hold return c; } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * Reverts when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b) internal pure returns (uint256) { return mod(a, b, "SafeMath: modulo by zero"); } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * Reverts with custom message when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b != 0, errorMessage); return a % b; } }
/** * @dev Wrappers over Solidity's arithmetic operations with added overflow * checks. * * Arithmetic operations in Solidity wrap on overflow. This can easily result * in bugs, because programmers usually assume that an overflow raises an * error, which is the standard behavior in high level programming languages. * `SafeMath` restores this intuition by reverting the transaction when an * operation overflows. * * Using this library instead of the unchecked operations eliminates an entire * class of bugs, so it's recommended to use it always. */
NatSpecMultiLine
mod
function mod(uint256 a, uint256 b) internal pure returns (uint256) { return mod(a, b, "SafeMath: modulo by zero"); }
/** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * Reverts when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */
NatSpecMultiLine
v0.6.12+commit.27d51765
None
ipfs://dc2ef5f183a3408ddfd271dfdddd9f9ea17de1f5c07a47614436fba036f0931b
{ "func_code_index": [ 3931, 4066 ] }
1,023
ChowChow
ChowChow.sol
0x795cd42ca45ee99398f8e3ae87c6c87c43183627
Solidity
SafeMath
library SafeMath { /** * @dev Returns the addition of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `+` operator. * * Requirements: * * - Addition cannot overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; require(c >= a, "SafeMath: addition overflow"); return c; } /** * @dev Returns the subtraction of two unsigned integers, reverting on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { return sub(a, b, "SafeMath: subtraction overflow"); } /** * @dev Returns the subtraction of two unsigned integers, reverting with custom message on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b <= a, errorMessage); uint256 c = a - b; return c; } /** * @dev Returns the multiplication of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `*` operator. * * Requirements: * * - Multiplication cannot overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522 if (a == 0) { return 0; } uint256 c = a * b; require(c / a == b, "SafeMath: multiplication overflow"); return c; } /** * @dev Returns the integer division of two unsigned integers. Reverts on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { return div(a, b, "SafeMath: division by zero"); } /** * @dev Returns the integer division of two unsigned integers. Reverts with custom message on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b > 0, errorMessage); uint256 c = a / b; // assert(a == b * c + a % b); // There is no case in which this doesn't hold return c; } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * Reverts when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b) internal pure returns (uint256) { return mod(a, b, "SafeMath: modulo by zero"); } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * Reverts with custom message when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b != 0, errorMessage); return a % b; } }
/** * @dev Wrappers over Solidity's arithmetic operations with added overflow * checks. * * Arithmetic operations in Solidity wrap on overflow. This can easily result * in bugs, because programmers usually assume that an overflow raises an * error, which is the standard behavior in high level programming languages. * `SafeMath` restores this intuition by reverting the transaction when an * operation overflows. * * Using this library instead of the unchecked operations eliminates an entire * class of bugs, so it's recommended to use it always. */
NatSpecMultiLine
mod
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b != 0, errorMessage); return a % b; }
/** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * Reverts with custom message when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */
NatSpecMultiLine
v0.6.12+commit.27d51765
None
ipfs://dc2ef5f183a3408ddfd271dfdddd9f9ea17de1f5c07a47614436fba036f0931b
{ "func_code_index": [ 4546, 4717 ] }
1,024
ChowChow
ChowChow.sol
0x795cd42ca45ee99398f8e3ae87c6c87c43183627
Solidity
Address
library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== */ function isContract(address account) internal view returns (bool) { // According to EIP-1052, 0x0 is the value returned for not-yet created accounts // and 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470 is returned // for accounts without code, i.e. `keccak256('')` bytes32 codehash; bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470; // solhint-disable-next-line no-inline-assembly assembly { codehash := extcodehash(account) } return (codehash != accountHash && codehash != 0x0); } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); // solhint-disable-next-line avoid-low-level-calls, avoid-call-value (bool success, ) = recipient.call{ value: amount }(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain`call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCall(target, data, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) { return _functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); return _functionCallWithValue(target, data, value, errorMessage); } function _functionCallWithValue(address target, bytes memory data, uint256 weiValue, string memory errorMessage) private returns (bytes memory) { require(isContract(target), "Address: call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.call{ value: weiValue }(data); if (success) { return returndata; } else { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly // solhint-disable-next-line no-inline-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } }
/** * @dev Collection of functions related to the address type */
NatSpecMultiLine
isContract
function isContract(address account) internal view returns (bool) { // According to EIP-1052, 0x0 is the value returned for not-yet created accounts // and 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470 is returned // for accounts without code, i.e. `keccak256('')` bytes32 codehash; bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470; // solhint-disable-next-line no-inline-assembly assembly { codehash := extcodehash(account) } return (codehash != accountHash && codehash != 0x0); }
/** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== */
NatSpecMultiLine
v0.6.12+commit.27d51765
None
ipfs://dc2ef5f183a3408ddfd271dfdddd9f9ea17de1f5c07a47614436fba036f0931b
{ "func_code_index": [ 606, 1230 ] }
1,025
ChowChow
ChowChow.sol
0x795cd42ca45ee99398f8e3ae87c6c87c43183627
Solidity
Address
library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== */ function isContract(address account) internal view returns (bool) { // According to EIP-1052, 0x0 is the value returned for not-yet created accounts // and 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470 is returned // for accounts without code, i.e. `keccak256('')` bytes32 codehash; bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470; // solhint-disable-next-line no-inline-assembly assembly { codehash := extcodehash(account) } return (codehash != accountHash && codehash != 0x0); } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); // solhint-disable-next-line avoid-low-level-calls, avoid-call-value (bool success, ) = recipient.call{ value: amount }(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain`call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCall(target, data, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) { return _functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); return _functionCallWithValue(target, data, value, errorMessage); } function _functionCallWithValue(address target, bytes memory data, uint256 weiValue, string memory errorMessage) private returns (bytes memory) { require(isContract(target), "Address: call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.call{ value: weiValue }(data); if (success) { return returndata; } else { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly // solhint-disable-next-line no-inline-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } }
/** * @dev Collection of functions related to the address type */
NatSpecMultiLine
sendValue
function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); // solhint-disable-next-line avoid-low-level-calls, avoid-call-value (bool success, ) = recipient.call{ value: amount }(""); require(success, "Address: unable to send value, recipient may have reverted"); }
/** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */
NatSpecMultiLine
v0.6.12+commit.27d51765
None
ipfs://dc2ef5f183a3408ddfd271dfdddd9f9ea17de1f5c07a47614436fba036f0931b
{ "func_code_index": [ 2160, 2562 ] }
1,026
ChowChow
ChowChow.sol
0x795cd42ca45ee99398f8e3ae87c6c87c43183627
Solidity
Address
library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== */ function isContract(address account) internal view returns (bool) { // According to EIP-1052, 0x0 is the value returned for not-yet created accounts // and 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470 is returned // for accounts without code, i.e. `keccak256('')` bytes32 codehash; bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470; // solhint-disable-next-line no-inline-assembly assembly { codehash := extcodehash(account) } return (codehash != accountHash && codehash != 0x0); } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); // solhint-disable-next-line avoid-low-level-calls, avoid-call-value (bool success, ) = recipient.call{ value: amount }(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain`call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCall(target, data, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) { return _functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); return _functionCallWithValue(target, data, value, errorMessage); } function _functionCallWithValue(address target, bytes memory data, uint256 weiValue, string memory errorMessage) private returns (bytes memory) { require(isContract(target), "Address: call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.call{ value: weiValue }(data); if (success) { return returndata; } else { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly // solhint-disable-next-line no-inline-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } }
/** * @dev Collection of functions related to the address type */
NatSpecMultiLine
functionCall
function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCall(target, data, "Address: low-level call failed"); }
/** * @dev Performs a Solidity function call using a low level `call`. A * plain`call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */
NatSpecMultiLine
v0.6.12+commit.27d51765
None
ipfs://dc2ef5f183a3408ddfd271dfdddd9f9ea17de1f5c07a47614436fba036f0931b
{ "func_code_index": [ 3318, 3496 ] }
1,027
ChowChow
ChowChow.sol
0x795cd42ca45ee99398f8e3ae87c6c87c43183627
Solidity
Address
library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== */ function isContract(address account) internal view returns (bool) { // According to EIP-1052, 0x0 is the value returned for not-yet created accounts // and 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470 is returned // for accounts without code, i.e. `keccak256('')` bytes32 codehash; bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470; // solhint-disable-next-line no-inline-assembly assembly { codehash := extcodehash(account) } return (codehash != accountHash && codehash != 0x0); } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); // solhint-disable-next-line avoid-low-level-calls, avoid-call-value (bool success, ) = recipient.call{ value: amount }(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain`call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCall(target, data, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) { return _functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); return _functionCallWithValue(target, data, value, errorMessage); } function _functionCallWithValue(address target, bytes memory data, uint256 weiValue, string memory errorMessage) private returns (bytes memory) { require(isContract(target), "Address: call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.call{ value: weiValue }(data); if (success) { return returndata; } else { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly // solhint-disable-next-line no-inline-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } }
/** * @dev Collection of functions related to the address type */
NatSpecMultiLine
functionCall
function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) { return _functionCallWithValue(target, data, 0, errorMessage); }
/** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */
NatSpecMultiLine
v0.6.12+commit.27d51765
None
ipfs://dc2ef5f183a3408ddfd271dfdddd9f9ea17de1f5c07a47614436fba036f0931b
{ "func_code_index": [ 3721, 3922 ] }
1,028
ChowChow
ChowChow.sol
0x795cd42ca45ee99398f8e3ae87c6c87c43183627
Solidity
Address
library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== */ function isContract(address account) internal view returns (bool) { // According to EIP-1052, 0x0 is the value returned for not-yet created accounts // and 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470 is returned // for accounts without code, i.e. `keccak256('')` bytes32 codehash; bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470; // solhint-disable-next-line no-inline-assembly assembly { codehash := extcodehash(account) } return (codehash != accountHash && codehash != 0x0); } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); // solhint-disable-next-line avoid-low-level-calls, avoid-call-value (bool success, ) = recipient.call{ value: amount }(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain`call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCall(target, data, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) { return _functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); return _functionCallWithValue(target, data, value, errorMessage); } function _functionCallWithValue(address target, bytes memory data, uint256 weiValue, string memory errorMessage) private returns (bytes memory) { require(isContract(target), "Address: call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.call{ value: weiValue }(data); if (success) { return returndata; } else { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly // solhint-disable-next-line no-inline-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } }
/** * @dev Collection of functions related to the address type */
NatSpecMultiLine
functionCallWithValue
function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); }
/** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */
NatSpecMultiLine
v0.6.12+commit.27d51765
None
ipfs://dc2ef5f183a3408ddfd271dfdddd9f9ea17de1f5c07a47614436fba036f0931b
{ "func_code_index": [ 4292, 4523 ] }
1,029
ChowChow
ChowChow.sol
0x795cd42ca45ee99398f8e3ae87c6c87c43183627
Solidity
Address
library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== */ function isContract(address account) internal view returns (bool) { // According to EIP-1052, 0x0 is the value returned for not-yet created accounts // and 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470 is returned // for accounts without code, i.e. `keccak256('')` bytes32 codehash; bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470; // solhint-disable-next-line no-inline-assembly assembly { codehash := extcodehash(account) } return (codehash != accountHash && codehash != 0x0); } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); // solhint-disable-next-line avoid-low-level-calls, avoid-call-value (bool success, ) = recipient.call{ value: amount }(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain`call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCall(target, data, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) { return _functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); return _functionCallWithValue(target, data, value, errorMessage); } function _functionCallWithValue(address target, bytes memory data, uint256 weiValue, string memory errorMessage) private returns (bytes memory) { require(isContract(target), "Address: call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.call{ value: weiValue }(data); if (success) { return returndata; } else { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly // solhint-disable-next-line no-inline-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } }
/** * @dev Collection of functions related to the address type */
NatSpecMultiLine
functionCallWithValue
function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); return _functionCallWithValue(target, data, value, errorMessage); }
/** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */
NatSpecMultiLine
v0.6.12+commit.27d51765
None
ipfs://dc2ef5f183a3408ddfd271dfdddd9f9ea17de1f5c07a47614436fba036f0931b
{ "func_code_index": [ 4774, 5095 ] }
1,030
ChowChow
ChowChow.sol
0x795cd42ca45ee99398f8e3ae87c6c87c43183627
Solidity
Ownable
contract Ownable is Context { address private _owner; address private _previousOwner; uint256 private _lockTime; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor () internal { address msgSender = _msgSender(); _owner = msgSender; emit OwnershipTransferred(address(0), msgSender); } /** * @dev Returns the address of the current owner. */ function owner() public view returns (address) { return _owner; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(_owner == _msgSender(), "Ownable: caller is not the owner"); _; } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { emit OwnershipTransferred(_owner, address(0)); _owner = address(0); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { require(newOwner != address(0), "Ownable: new owner is the zero address"); emit OwnershipTransferred(_owner, newOwner); _owner = newOwner; } function geUnlockTime() public view returns (uint256) { return _lockTime; } //Locks the contract for owner for the amount of time provided function lock(uint256 time) public virtual onlyOwner { _previousOwner = _owner; _owner = address(0); _lockTime = now + time; emit OwnershipTransferred(_owner, address(0)); } //Unlocks the contract for owner when _lockTime is exceeds function unlock() public virtual { require(_previousOwner == msg.sender, "You don't have permission to unlock"); require(now > _lockTime , "Contract is locked until 7 days"); emit OwnershipTransferred(_owner, _previousOwner); _owner = _previousOwner; } }
/** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * By default, the owner account will be the one that deploys the contract. This * can later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */
NatSpecMultiLine
owner
function owner() public view returns (address) { return _owner; }
/** * @dev Returns the address of the current owner. */
NatSpecMultiLine
v0.6.12+commit.27d51765
None
ipfs://dc2ef5f183a3408ddfd271dfdddd9f9ea17de1f5c07a47614436fba036f0931b
{ "func_code_index": [ 566, 650 ] }
1,031
ChowChow
ChowChow.sol
0x795cd42ca45ee99398f8e3ae87c6c87c43183627
Solidity
Ownable
contract Ownable is Context { address private _owner; address private _previousOwner; uint256 private _lockTime; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor () internal { address msgSender = _msgSender(); _owner = msgSender; emit OwnershipTransferred(address(0), msgSender); } /** * @dev Returns the address of the current owner. */ function owner() public view returns (address) { return _owner; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(_owner == _msgSender(), "Ownable: caller is not the owner"); _; } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { emit OwnershipTransferred(_owner, address(0)); _owner = address(0); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { require(newOwner != address(0), "Ownable: new owner is the zero address"); emit OwnershipTransferred(_owner, newOwner); _owner = newOwner; } function geUnlockTime() public view returns (uint256) { return _lockTime; } //Locks the contract for owner for the amount of time provided function lock(uint256 time) public virtual onlyOwner { _previousOwner = _owner; _owner = address(0); _lockTime = now + time; emit OwnershipTransferred(_owner, address(0)); } //Unlocks the contract for owner when _lockTime is exceeds function unlock() public virtual { require(_previousOwner == msg.sender, "You don't have permission to unlock"); require(now > _lockTime , "Contract is locked until 7 days"); emit OwnershipTransferred(_owner, _previousOwner); _owner = _previousOwner; } }
/** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * By default, the owner account will be the one that deploys the contract. This * can later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */
NatSpecMultiLine
renounceOwnership
function renounceOwnership() public virtual onlyOwner { emit OwnershipTransferred(_owner, address(0)); _owner = address(0); }
/** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */
NatSpecMultiLine
v0.6.12+commit.27d51765
None
ipfs://dc2ef5f183a3408ddfd271dfdddd9f9ea17de1f5c07a47614436fba036f0931b
{ "func_code_index": [ 1209, 1362 ] }
1,032
ChowChow
ChowChow.sol
0x795cd42ca45ee99398f8e3ae87c6c87c43183627
Solidity
Ownable
contract Ownable is Context { address private _owner; address private _previousOwner; uint256 private _lockTime; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor () internal { address msgSender = _msgSender(); _owner = msgSender; emit OwnershipTransferred(address(0), msgSender); } /** * @dev Returns the address of the current owner. */ function owner() public view returns (address) { return _owner; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(_owner == _msgSender(), "Ownable: caller is not the owner"); _; } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { emit OwnershipTransferred(_owner, address(0)); _owner = address(0); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { require(newOwner != address(0), "Ownable: new owner is the zero address"); emit OwnershipTransferred(_owner, newOwner); _owner = newOwner; } function geUnlockTime() public view returns (uint256) { return _lockTime; } //Locks the contract for owner for the amount of time provided function lock(uint256 time) public virtual onlyOwner { _previousOwner = _owner; _owner = address(0); _lockTime = now + time; emit OwnershipTransferred(_owner, address(0)); } //Unlocks the contract for owner when _lockTime is exceeds function unlock() public virtual { require(_previousOwner == msg.sender, "You don't have permission to unlock"); require(now > _lockTime , "Contract is locked until 7 days"); emit OwnershipTransferred(_owner, _previousOwner); _owner = _previousOwner; } }
/** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * By default, the owner account will be the one that deploys the contract. This * can later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */
NatSpecMultiLine
transferOwnership
function transferOwnership(address newOwner) public virtual onlyOwner { require(newOwner != address(0), "Ownable: new owner is the zero address"); emit OwnershipTransferred(_owner, newOwner); _owner = newOwner; }
/** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */
NatSpecMultiLine
v0.6.12+commit.27d51765
None
ipfs://dc2ef5f183a3408ddfd271dfdddd9f9ea17de1f5c07a47614436fba036f0931b
{ "func_code_index": [ 1512, 1761 ] }
1,033
ChowChow
ChowChow.sol
0x795cd42ca45ee99398f8e3ae87c6c87c43183627
Solidity
Ownable
contract Ownable is Context { address private _owner; address private _previousOwner; uint256 private _lockTime; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor () internal { address msgSender = _msgSender(); _owner = msgSender; emit OwnershipTransferred(address(0), msgSender); } /** * @dev Returns the address of the current owner. */ function owner() public view returns (address) { return _owner; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(_owner == _msgSender(), "Ownable: caller is not the owner"); _; } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { emit OwnershipTransferred(_owner, address(0)); _owner = address(0); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { require(newOwner != address(0), "Ownable: new owner is the zero address"); emit OwnershipTransferred(_owner, newOwner); _owner = newOwner; } function geUnlockTime() public view returns (uint256) { return _lockTime; } //Locks the contract for owner for the amount of time provided function lock(uint256 time) public virtual onlyOwner { _previousOwner = _owner; _owner = address(0); _lockTime = now + time; emit OwnershipTransferred(_owner, address(0)); } //Unlocks the contract for owner when _lockTime is exceeds function unlock() public virtual { require(_previousOwner == msg.sender, "You don't have permission to unlock"); require(now > _lockTime , "Contract is locked until 7 days"); emit OwnershipTransferred(_owner, _previousOwner); _owner = _previousOwner; } }
/** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * By default, the owner account will be the one that deploys the contract. This * can later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */
NatSpecMultiLine
lock
function lock(uint256 time) public virtual onlyOwner { _previousOwner = _owner; _owner = address(0); _lockTime = now + time; emit OwnershipTransferred(_owner, address(0)); }
//Locks the contract for owner for the amount of time provided
LineComment
v0.6.12+commit.27d51765
None
ipfs://dc2ef5f183a3408ddfd271dfdddd9f9ea17de1f5c07a47614436fba036f0931b
{ "func_code_index": [ 1929, 2148 ] }
1,034
ChowChow
ChowChow.sol
0x795cd42ca45ee99398f8e3ae87c6c87c43183627
Solidity
Ownable
contract Ownable is Context { address private _owner; address private _previousOwner; uint256 private _lockTime; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor () internal { address msgSender = _msgSender(); _owner = msgSender; emit OwnershipTransferred(address(0), msgSender); } /** * @dev Returns the address of the current owner. */ function owner() public view returns (address) { return _owner; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(_owner == _msgSender(), "Ownable: caller is not the owner"); _; } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { emit OwnershipTransferred(_owner, address(0)); _owner = address(0); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { require(newOwner != address(0), "Ownable: new owner is the zero address"); emit OwnershipTransferred(_owner, newOwner); _owner = newOwner; } function geUnlockTime() public view returns (uint256) { return _lockTime; } //Locks the contract for owner for the amount of time provided function lock(uint256 time) public virtual onlyOwner { _previousOwner = _owner; _owner = address(0); _lockTime = now + time; emit OwnershipTransferred(_owner, address(0)); } //Unlocks the contract for owner when _lockTime is exceeds function unlock() public virtual { require(_previousOwner == msg.sender, "You don't have permission to unlock"); require(now > _lockTime , "Contract is locked until 7 days"); emit OwnershipTransferred(_owner, _previousOwner); _owner = _previousOwner; } }
/** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * By default, the owner account will be the one that deploys the contract. This * can later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */
NatSpecMultiLine
unlock
function unlock() public virtual { require(_previousOwner == msg.sender, "You don't have permission to unlock"); require(now > _lockTime , "Contract is locked until 7 days"); emit OwnershipTransferred(_owner, _previousOwner); _owner = _previousOwner; }
//Unlocks the contract for owner when _lockTime is exceeds
LineComment
v0.6.12+commit.27d51765
None
ipfs://dc2ef5f183a3408ddfd271dfdddd9f9ea17de1f5c07a47614436fba036f0931b
{ "func_code_index": [ 2215, 2513 ] }
1,035
ChowChow
ChowChow.sol
0x795cd42ca45ee99398f8e3ae87c6c87c43183627
Solidity
ChowChow
contract ChowChow is Context, IERC20, Ownable { using SafeMath for uint256; using Address for address; mapping (address => uint256) private _rOwned; mapping (address => uint256) private _tOwned; mapping (address => mapping (address => uint256)) private _allowances; mapping (address => bool) private _isExcludedFromFee; mapping (address => bool) private _isExcluded; address[] private _excluded; uint256 private constant MAX = ~uint256(0); uint256 private _tTotal = 1000000000 * 10**6 * 10**9; uint256 private _rTotal = (MAX - (MAX % _tTotal)); uint256 private _tFeeTotal; string private _name = "ChowChow"; string private _symbol = "CHOWCHOW"; uint8 private _decimals = 9; uint256 public _taxFee = 5; uint256 private _previousTaxFee = _taxFee; uint256 public _liquidityFee = 5; uint256 private _previousLiquidityFee = _liquidityFee; IUniswapV2Router02 public immutable uniswapV2Router; address public immutable uniswapV2Pair; bool inSwapAndLiquify; bool public swapAndLiquifyEnabled = true; uint256 public _maxTxAmount = 5000000 * 10**6 * 10**9; uint256 private numTokensSellToAddToLiquidity = 500000 * 10**6 * 10**9; event MinTokensBeforeSwapUpdated(uint256 minTokensBeforeSwap); event SwapAndLiquifyEnabledUpdated(bool enabled); event SwapAndLiquify( uint256 tokensSwapped, uint256 ethReceived, uint256 tokensIntoLiqudity ); modifier lockTheSwap { inSwapAndLiquify = true; _; inSwapAndLiquify = false; } constructor () public { _rOwned[_msgSender()] = _rTotal; IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D); // Create a uniswap pair for this new token uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()) .createPair(address(this), _uniswapV2Router.WETH()); // set the rest of the contract variables uniswapV2Router = _uniswapV2Router; //exclude owner and this contract from fee _isExcludedFromFee[owner()] = true; _isExcludedFromFee[address(this)] = true; emit Transfer(address(0), _msgSender(), _tTotal); } function name() public view returns (string memory) { return _name; } function symbol() public view returns (string memory) { return _symbol; } function decimals() public view returns (uint8) { return _decimals; } function totalSupply() public view override returns (uint256) { return _tTotal; } function balanceOf(address account) public view override returns (uint256) { if (_isExcluded[account]) return _tOwned[account]; return tokenFromReflection(_rOwned[account]); } function transfer(address recipient, uint256 amount) public override returns (bool) { _transfer(_msgSender(), recipient, amount); return true; } function allowance(address owner, address spender) public view override returns (uint256) { return _allowances[owner][spender]; } function approve(address spender, uint256 amount) public override returns (bool) { _approve(_msgSender(), spender, amount); return true; } function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) { _transfer(sender, recipient, amount); _approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance")); return true; } function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue)); return true; } function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, "ERC20: decreased allowance below zero")); return true; } function isExcludedFromReward(address account) public view returns (bool) { return _isExcluded[account]; } function totalFees() public view returns (uint256) { return _tFeeTotal; } function deliver(uint256 tAmount) public { address sender = _msgSender(); require(!_isExcluded[sender], "Excluded addresses cannot call this function"); (uint256 rAmount,,,,,) = _getValues(tAmount); _rOwned[sender] = _rOwned[sender].sub(rAmount); _rTotal = _rTotal.sub(rAmount); _tFeeTotal = _tFeeTotal.add(tAmount); } function reflectionFromToken(uint256 tAmount, bool deductTransferFee) public view returns(uint256) { require(tAmount <= _tTotal, "Amount must be less than supply"); if (!deductTransferFee) { (uint256 rAmount,,,,,) = _getValues(tAmount); return rAmount; } else { (,uint256 rTransferAmount,,,,) = _getValues(tAmount); return rTransferAmount; } } function tokenFromReflection(uint256 rAmount) public view returns(uint256) { require(rAmount <= _rTotal, "Amount must be less than total reflections"); uint256 currentRate = _getRate(); return rAmount.div(currentRate); } function excludeFromReward(address account) public onlyOwner() { // require(account != 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D, 'We can not exclude Uniswap router.'); require(!_isExcluded[account], "Account is already excluded"); if(_rOwned[account] > 0) { _tOwned[account] = tokenFromReflection(_rOwned[account]); } _isExcluded[account] = true; _excluded.push(account); } function includeInReward(address account) external onlyOwner() { require(_isExcluded[account], "Account is already excluded"); for (uint256 i = 0; i < _excluded.length; i++) { if (_excluded[i] == account) { _excluded[i] = _excluded[_excluded.length - 1]; _tOwned[account] = 0; _isExcluded[account] = false; _excluded.pop(); break; } } } function _transferBothExcluded(address sender, address recipient, uint256 tAmount) private { (uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tLiquidity) = _getValues(tAmount); _tOwned[sender] = _tOwned[sender].sub(tAmount); _rOwned[sender] = _rOwned[sender].sub(rAmount); _tOwned[recipient] = _tOwned[recipient].add(tTransferAmount); _rOwned[recipient] = _rOwned[recipient].add(rTransferAmount); _takeLiquidity(tLiquidity); _reflectFee(rFee, tFee); emit Transfer(sender, recipient, tTransferAmount); } function excludeFromFee(address account) public onlyOwner { _isExcludedFromFee[account] = true; } function includeInFee(address account) public onlyOwner { _isExcludedFromFee[account] = false; } function setTaxFeePercent(uint256 taxFee) external onlyOwner() { _taxFee = taxFee; } function setLiquidityFeePercent(uint256 liquidityFee) external onlyOwner() { _liquidityFee = liquidityFee; } function setMaxTxPercent(uint256 maxTxPercent) external onlyOwner() { _maxTxAmount = _tTotal.mul(maxTxPercent).div( 10**2 ); } function setSwapAndLiquifyEnabled(bool _enabled) public onlyOwner { swapAndLiquifyEnabled = _enabled; emit SwapAndLiquifyEnabledUpdated(_enabled); } //to recieve ETH from uniswapV2Router when swaping receive() external payable {} function _reflectFee(uint256 rFee, uint256 tFee) private { _rTotal = _rTotal.sub(rFee); _tFeeTotal = _tFeeTotal.add(tFee); } function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256) { (uint256 tTransferAmount, uint256 tFee, uint256 tLiquidity) = _getTValues(tAmount); (uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, tLiquidity, _getRate()); return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tLiquidity); } function _getTValues(uint256 tAmount) private view returns (uint256, uint256, uint256) { uint256 tFee = calculateTaxFee(tAmount); uint256 tLiquidity = calculateLiquidityFee(tAmount); uint256 tTransferAmount = tAmount.sub(tFee).sub(tLiquidity); return (tTransferAmount, tFee, tLiquidity); } function _getRValues(uint256 tAmount, uint256 tFee, uint256 tLiquidity, uint256 currentRate) private pure returns (uint256, uint256, uint256) { uint256 rAmount = tAmount.mul(currentRate); uint256 rFee = tFee.mul(currentRate); uint256 rLiquidity = tLiquidity.mul(currentRate); uint256 rTransferAmount = rAmount.sub(rFee).sub(rLiquidity); return (rAmount, rTransferAmount, rFee); } function _getRate() private view returns(uint256) { (uint256 rSupply, uint256 tSupply) = _getCurrentSupply(); return rSupply.div(tSupply); } function _getCurrentSupply() private view returns(uint256, uint256) { uint256 rSupply = _rTotal; uint256 tSupply = _tTotal; for (uint256 i = 0; i < _excluded.length; i++) { if (_rOwned[_excluded[i]] > rSupply || _tOwned[_excluded[i]] > tSupply) return (_rTotal, _tTotal); rSupply = rSupply.sub(_rOwned[_excluded[i]]); tSupply = tSupply.sub(_tOwned[_excluded[i]]); } if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal); return (rSupply, tSupply); } function _takeLiquidity(uint256 tLiquidity) private { uint256 currentRate = _getRate(); uint256 rLiquidity = tLiquidity.mul(currentRate); _rOwned[address(this)] = _rOwned[address(this)].add(rLiquidity); if(_isExcluded[address(this)]) _tOwned[address(this)] = _tOwned[address(this)].add(tLiquidity); } function calculateTaxFee(uint256 _amount) private view returns (uint256) { return _amount.mul(_taxFee).div( 10**2 ); } function calculateLiquidityFee(uint256 _amount) private view returns (uint256) { return _amount.mul(_liquidityFee).div( 10**2 ); } function removeAllFee() private { if(_taxFee == 0 && _liquidityFee == 0) return; _previousTaxFee = _taxFee; _previousLiquidityFee = _liquidityFee; _taxFee = 0; _liquidityFee = 0; } function restoreAllFee() private { _taxFee = _previousTaxFee; _liquidityFee = _previousLiquidityFee; } function isExcludedFromFee(address account) public view returns(bool) { return _isExcludedFromFee[account]; } function _approve(address owner, address spender, uint256 amount) private { require(owner != address(0), "ERC20: approve from the zero address"); require(spender != address(0), "ERC20: approve to the zero address"); _allowances[owner][spender] = amount; emit Approval(owner, spender, amount); } function _transfer( address from, address to, uint256 amount ) private { require(from != address(0), "ERC20: transfer from the zero address"); require(to != address(0), "ERC20: transfer to the zero address"); require(amount > 0, "Transfer amount must be greater than zero"); if(from != owner() && to != owner()) require(amount <= _maxTxAmount, "Transfer amount exceeds the maxTxAmount."); // is the token balance of this contract address over the min number of // tokens that we need to initiate a swap + liquidity lock? // also, don't get caught in a circular liquidity event. // also, don't swap & liquify if sender is uniswap pair. uint256 contractTokenBalance = balanceOf(address(this)); if(contractTokenBalance >= _maxTxAmount) { contractTokenBalance = _maxTxAmount; } bool overMinTokenBalance = contractTokenBalance >= numTokensSellToAddToLiquidity; if ( overMinTokenBalance && !inSwapAndLiquify && from != uniswapV2Pair && swapAndLiquifyEnabled ) { contractTokenBalance = numTokensSellToAddToLiquidity; //add liquidity swapAndLiquify(contractTokenBalance); } //indicates if fee should be deducted from transfer bool takeFee = true; //if any account belongs to _isExcludedFromFee account then remove the fee if(_isExcludedFromFee[from] || _isExcludedFromFee[to]){ takeFee = false; } //transfer amount, it will take tax, burn, liquidity fee _tokenTransfer(from,to,amount,takeFee); } function swapAndLiquify(uint256 contractTokenBalance) private lockTheSwap { // split the contract balance into halves uint256 half = contractTokenBalance.div(2); uint256 otherHalf = contractTokenBalance.sub(half); // capture the contract's current ETH balance. // this is so that we can capture exactly the amount of ETH that the // swap creates, and not make the liquidity event include any ETH that // has been manually sent to the contract uint256 initialBalance = address(this).balance; // swap tokens for ETH swapTokensForEth(half); // <- this breaks the ETH -> HATE swap when swap+liquify is triggered // how much ETH did we just swap into? uint256 newBalance = address(this).balance.sub(initialBalance); // add liquidity to uniswap addLiquidity(otherHalf, newBalance); emit SwapAndLiquify(half, newBalance, otherHalf); } function swapTokensForEth(uint256 tokenAmount) private { // generate the uniswap pair path of token -> weth address[] memory path = new address[](2); path[0] = address(this); path[1] = uniswapV2Router.WETH(); _approve(address(this), address(uniswapV2Router), tokenAmount); // make the swap uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens( tokenAmount, 0, // accept any amount of ETH path, address(this), block.timestamp ); } function addLiquidity(uint256 tokenAmount, uint256 ethAmount) private { // approve token transfer to cover all possible scenarios _approve(address(this), address(uniswapV2Router), tokenAmount); // add the liquidity uniswapV2Router.addLiquidityETH{value: ethAmount}( address(this), tokenAmount, 0, // slippage is unavoidable 0, // slippage is unavoidable owner(), block.timestamp ); } //this method is responsible for taking all fee, if takeFee is true function _tokenTransfer(address sender, address recipient, uint256 amount,bool takeFee) private { if(!takeFee) removeAllFee(); if (_isExcluded[sender] && !_isExcluded[recipient]) { _transferFromExcluded(sender, recipient, amount); } else if (!_isExcluded[sender] && _isExcluded[recipient]) { _transferToExcluded(sender, recipient, amount); } else if (!_isExcluded[sender] && !_isExcluded[recipient]) { _transferStandard(sender, recipient, amount); } else if (_isExcluded[sender] && _isExcluded[recipient]) { _transferBothExcluded(sender, recipient, amount); } else { _transferStandard(sender, recipient, amount); } if(!takeFee) restoreAllFee(); } function _transferStandard(address sender, address recipient, uint256 tAmount) private { (uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tLiquidity) = _getValues(tAmount); _rOwned[sender] = _rOwned[sender].sub(rAmount); _rOwned[recipient] = _rOwned[recipient].add(rTransferAmount); _takeLiquidity(tLiquidity); _reflectFee(rFee, tFee); emit Transfer(sender, recipient, tTransferAmount); } function _transferToExcluded(address sender, address recipient, uint256 tAmount) private { (uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tLiquidity) = _getValues(tAmount); _rOwned[sender] = _rOwned[sender].sub(rAmount); _tOwned[recipient] = _tOwned[recipient].add(tTransferAmount); _rOwned[recipient] = _rOwned[recipient].add(rTransferAmount); _takeLiquidity(tLiquidity); _reflectFee(rFee, tFee); emit Transfer(sender, recipient, tTransferAmount); } function _transferFromExcluded(address sender, address recipient, uint256 tAmount) private { (uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tLiquidity) = _getValues(tAmount); _tOwned[sender] = _tOwned[sender].sub(tAmount); _rOwned[sender] = _rOwned[sender].sub(rAmount); _rOwned[recipient] = _rOwned[recipient].add(rTransferAmount); _takeLiquidity(tLiquidity); _reflectFee(rFee, tFee); emit Transfer(sender, recipient, tTransferAmount); } }
//to recieve ETH from uniswapV2Router when swaping
LineComment
v0.6.12+commit.27d51765
None
ipfs://dc2ef5f183a3408ddfd271dfdddd9f9ea17de1f5c07a47614436fba036f0931b
{ "func_code_index": [ 8023, 8057 ] }
1,036
ChowChow
ChowChow.sol
0x795cd42ca45ee99398f8e3ae87c6c87c43183627
Solidity
ChowChow
contract ChowChow is Context, IERC20, Ownable { using SafeMath for uint256; using Address for address; mapping (address => uint256) private _rOwned; mapping (address => uint256) private _tOwned; mapping (address => mapping (address => uint256)) private _allowances; mapping (address => bool) private _isExcludedFromFee; mapping (address => bool) private _isExcluded; address[] private _excluded; uint256 private constant MAX = ~uint256(0); uint256 private _tTotal = 1000000000 * 10**6 * 10**9; uint256 private _rTotal = (MAX - (MAX % _tTotal)); uint256 private _tFeeTotal; string private _name = "ChowChow"; string private _symbol = "CHOWCHOW"; uint8 private _decimals = 9; uint256 public _taxFee = 5; uint256 private _previousTaxFee = _taxFee; uint256 public _liquidityFee = 5; uint256 private _previousLiquidityFee = _liquidityFee; IUniswapV2Router02 public immutable uniswapV2Router; address public immutable uniswapV2Pair; bool inSwapAndLiquify; bool public swapAndLiquifyEnabled = true; uint256 public _maxTxAmount = 5000000 * 10**6 * 10**9; uint256 private numTokensSellToAddToLiquidity = 500000 * 10**6 * 10**9; event MinTokensBeforeSwapUpdated(uint256 minTokensBeforeSwap); event SwapAndLiquifyEnabledUpdated(bool enabled); event SwapAndLiquify( uint256 tokensSwapped, uint256 ethReceived, uint256 tokensIntoLiqudity ); modifier lockTheSwap { inSwapAndLiquify = true; _; inSwapAndLiquify = false; } constructor () public { _rOwned[_msgSender()] = _rTotal; IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D); // Create a uniswap pair for this new token uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()) .createPair(address(this), _uniswapV2Router.WETH()); // set the rest of the contract variables uniswapV2Router = _uniswapV2Router; //exclude owner and this contract from fee _isExcludedFromFee[owner()] = true; _isExcludedFromFee[address(this)] = true; emit Transfer(address(0), _msgSender(), _tTotal); } function name() public view returns (string memory) { return _name; } function symbol() public view returns (string memory) { return _symbol; } function decimals() public view returns (uint8) { return _decimals; } function totalSupply() public view override returns (uint256) { return _tTotal; } function balanceOf(address account) public view override returns (uint256) { if (_isExcluded[account]) return _tOwned[account]; return tokenFromReflection(_rOwned[account]); } function transfer(address recipient, uint256 amount) public override returns (bool) { _transfer(_msgSender(), recipient, amount); return true; } function allowance(address owner, address spender) public view override returns (uint256) { return _allowances[owner][spender]; } function approve(address spender, uint256 amount) public override returns (bool) { _approve(_msgSender(), spender, amount); return true; } function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) { _transfer(sender, recipient, amount); _approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance")); return true; } function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue)); return true; } function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, "ERC20: decreased allowance below zero")); return true; } function isExcludedFromReward(address account) public view returns (bool) { return _isExcluded[account]; } function totalFees() public view returns (uint256) { return _tFeeTotal; } function deliver(uint256 tAmount) public { address sender = _msgSender(); require(!_isExcluded[sender], "Excluded addresses cannot call this function"); (uint256 rAmount,,,,,) = _getValues(tAmount); _rOwned[sender] = _rOwned[sender].sub(rAmount); _rTotal = _rTotal.sub(rAmount); _tFeeTotal = _tFeeTotal.add(tAmount); } function reflectionFromToken(uint256 tAmount, bool deductTransferFee) public view returns(uint256) { require(tAmount <= _tTotal, "Amount must be less than supply"); if (!deductTransferFee) { (uint256 rAmount,,,,,) = _getValues(tAmount); return rAmount; } else { (,uint256 rTransferAmount,,,,) = _getValues(tAmount); return rTransferAmount; } } function tokenFromReflection(uint256 rAmount) public view returns(uint256) { require(rAmount <= _rTotal, "Amount must be less than total reflections"); uint256 currentRate = _getRate(); return rAmount.div(currentRate); } function excludeFromReward(address account) public onlyOwner() { // require(account != 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D, 'We can not exclude Uniswap router.'); require(!_isExcluded[account], "Account is already excluded"); if(_rOwned[account] > 0) { _tOwned[account] = tokenFromReflection(_rOwned[account]); } _isExcluded[account] = true; _excluded.push(account); } function includeInReward(address account) external onlyOwner() { require(_isExcluded[account], "Account is already excluded"); for (uint256 i = 0; i < _excluded.length; i++) { if (_excluded[i] == account) { _excluded[i] = _excluded[_excluded.length - 1]; _tOwned[account] = 0; _isExcluded[account] = false; _excluded.pop(); break; } } } function _transferBothExcluded(address sender, address recipient, uint256 tAmount) private { (uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tLiquidity) = _getValues(tAmount); _tOwned[sender] = _tOwned[sender].sub(tAmount); _rOwned[sender] = _rOwned[sender].sub(rAmount); _tOwned[recipient] = _tOwned[recipient].add(tTransferAmount); _rOwned[recipient] = _rOwned[recipient].add(rTransferAmount); _takeLiquidity(tLiquidity); _reflectFee(rFee, tFee); emit Transfer(sender, recipient, tTransferAmount); } function excludeFromFee(address account) public onlyOwner { _isExcludedFromFee[account] = true; } function includeInFee(address account) public onlyOwner { _isExcludedFromFee[account] = false; } function setTaxFeePercent(uint256 taxFee) external onlyOwner() { _taxFee = taxFee; } function setLiquidityFeePercent(uint256 liquidityFee) external onlyOwner() { _liquidityFee = liquidityFee; } function setMaxTxPercent(uint256 maxTxPercent) external onlyOwner() { _maxTxAmount = _tTotal.mul(maxTxPercent).div( 10**2 ); } function setSwapAndLiquifyEnabled(bool _enabled) public onlyOwner { swapAndLiquifyEnabled = _enabled; emit SwapAndLiquifyEnabledUpdated(_enabled); } //to recieve ETH from uniswapV2Router when swaping receive() external payable {} function _reflectFee(uint256 rFee, uint256 tFee) private { _rTotal = _rTotal.sub(rFee); _tFeeTotal = _tFeeTotal.add(tFee); } function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256) { (uint256 tTransferAmount, uint256 tFee, uint256 tLiquidity) = _getTValues(tAmount); (uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, tLiquidity, _getRate()); return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tLiquidity); } function _getTValues(uint256 tAmount) private view returns (uint256, uint256, uint256) { uint256 tFee = calculateTaxFee(tAmount); uint256 tLiquidity = calculateLiquidityFee(tAmount); uint256 tTransferAmount = tAmount.sub(tFee).sub(tLiquidity); return (tTransferAmount, tFee, tLiquidity); } function _getRValues(uint256 tAmount, uint256 tFee, uint256 tLiquidity, uint256 currentRate) private pure returns (uint256, uint256, uint256) { uint256 rAmount = tAmount.mul(currentRate); uint256 rFee = tFee.mul(currentRate); uint256 rLiquidity = tLiquidity.mul(currentRate); uint256 rTransferAmount = rAmount.sub(rFee).sub(rLiquidity); return (rAmount, rTransferAmount, rFee); } function _getRate() private view returns(uint256) { (uint256 rSupply, uint256 tSupply) = _getCurrentSupply(); return rSupply.div(tSupply); } function _getCurrentSupply() private view returns(uint256, uint256) { uint256 rSupply = _rTotal; uint256 tSupply = _tTotal; for (uint256 i = 0; i < _excluded.length; i++) { if (_rOwned[_excluded[i]] > rSupply || _tOwned[_excluded[i]] > tSupply) return (_rTotal, _tTotal); rSupply = rSupply.sub(_rOwned[_excluded[i]]); tSupply = tSupply.sub(_tOwned[_excluded[i]]); } if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal); return (rSupply, tSupply); } function _takeLiquidity(uint256 tLiquidity) private { uint256 currentRate = _getRate(); uint256 rLiquidity = tLiquidity.mul(currentRate); _rOwned[address(this)] = _rOwned[address(this)].add(rLiquidity); if(_isExcluded[address(this)]) _tOwned[address(this)] = _tOwned[address(this)].add(tLiquidity); } function calculateTaxFee(uint256 _amount) private view returns (uint256) { return _amount.mul(_taxFee).div( 10**2 ); } function calculateLiquidityFee(uint256 _amount) private view returns (uint256) { return _amount.mul(_liquidityFee).div( 10**2 ); } function removeAllFee() private { if(_taxFee == 0 && _liquidityFee == 0) return; _previousTaxFee = _taxFee; _previousLiquidityFee = _liquidityFee; _taxFee = 0; _liquidityFee = 0; } function restoreAllFee() private { _taxFee = _previousTaxFee; _liquidityFee = _previousLiquidityFee; } function isExcludedFromFee(address account) public view returns(bool) { return _isExcludedFromFee[account]; } function _approve(address owner, address spender, uint256 amount) private { require(owner != address(0), "ERC20: approve from the zero address"); require(spender != address(0), "ERC20: approve to the zero address"); _allowances[owner][spender] = amount; emit Approval(owner, spender, amount); } function _transfer( address from, address to, uint256 amount ) private { require(from != address(0), "ERC20: transfer from the zero address"); require(to != address(0), "ERC20: transfer to the zero address"); require(amount > 0, "Transfer amount must be greater than zero"); if(from != owner() && to != owner()) require(amount <= _maxTxAmount, "Transfer amount exceeds the maxTxAmount."); // is the token balance of this contract address over the min number of // tokens that we need to initiate a swap + liquidity lock? // also, don't get caught in a circular liquidity event. // also, don't swap & liquify if sender is uniswap pair. uint256 contractTokenBalance = balanceOf(address(this)); if(contractTokenBalance >= _maxTxAmount) { contractTokenBalance = _maxTxAmount; } bool overMinTokenBalance = contractTokenBalance >= numTokensSellToAddToLiquidity; if ( overMinTokenBalance && !inSwapAndLiquify && from != uniswapV2Pair && swapAndLiquifyEnabled ) { contractTokenBalance = numTokensSellToAddToLiquidity; //add liquidity swapAndLiquify(contractTokenBalance); } //indicates if fee should be deducted from transfer bool takeFee = true; //if any account belongs to _isExcludedFromFee account then remove the fee if(_isExcludedFromFee[from] || _isExcludedFromFee[to]){ takeFee = false; } //transfer amount, it will take tax, burn, liquidity fee _tokenTransfer(from,to,amount,takeFee); } function swapAndLiquify(uint256 contractTokenBalance) private lockTheSwap { // split the contract balance into halves uint256 half = contractTokenBalance.div(2); uint256 otherHalf = contractTokenBalance.sub(half); // capture the contract's current ETH balance. // this is so that we can capture exactly the amount of ETH that the // swap creates, and not make the liquidity event include any ETH that // has been manually sent to the contract uint256 initialBalance = address(this).balance; // swap tokens for ETH swapTokensForEth(half); // <- this breaks the ETH -> HATE swap when swap+liquify is triggered // how much ETH did we just swap into? uint256 newBalance = address(this).balance.sub(initialBalance); // add liquidity to uniswap addLiquidity(otherHalf, newBalance); emit SwapAndLiquify(half, newBalance, otherHalf); } function swapTokensForEth(uint256 tokenAmount) private { // generate the uniswap pair path of token -> weth address[] memory path = new address[](2); path[0] = address(this); path[1] = uniswapV2Router.WETH(); _approve(address(this), address(uniswapV2Router), tokenAmount); // make the swap uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens( tokenAmount, 0, // accept any amount of ETH path, address(this), block.timestamp ); } function addLiquidity(uint256 tokenAmount, uint256 ethAmount) private { // approve token transfer to cover all possible scenarios _approve(address(this), address(uniswapV2Router), tokenAmount); // add the liquidity uniswapV2Router.addLiquidityETH{value: ethAmount}( address(this), tokenAmount, 0, // slippage is unavoidable 0, // slippage is unavoidable owner(), block.timestamp ); } //this method is responsible for taking all fee, if takeFee is true function _tokenTransfer(address sender, address recipient, uint256 amount,bool takeFee) private { if(!takeFee) removeAllFee(); if (_isExcluded[sender] && !_isExcluded[recipient]) { _transferFromExcluded(sender, recipient, amount); } else if (!_isExcluded[sender] && _isExcluded[recipient]) { _transferToExcluded(sender, recipient, amount); } else if (!_isExcluded[sender] && !_isExcluded[recipient]) { _transferStandard(sender, recipient, amount); } else if (_isExcluded[sender] && _isExcluded[recipient]) { _transferBothExcluded(sender, recipient, amount); } else { _transferStandard(sender, recipient, amount); } if(!takeFee) restoreAllFee(); } function _transferStandard(address sender, address recipient, uint256 tAmount) private { (uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tLiquidity) = _getValues(tAmount); _rOwned[sender] = _rOwned[sender].sub(rAmount); _rOwned[recipient] = _rOwned[recipient].add(rTransferAmount); _takeLiquidity(tLiquidity); _reflectFee(rFee, tFee); emit Transfer(sender, recipient, tTransferAmount); } function _transferToExcluded(address sender, address recipient, uint256 tAmount) private { (uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tLiquidity) = _getValues(tAmount); _rOwned[sender] = _rOwned[sender].sub(rAmount); _tOwned[recipient] = _tOwned[recipient].add(tTransferAmount); _rOwned[recipient] = _rOwned[recipient].add(rTransferAmount); _takeLiquidity(tLiquidity); _reflectFee(rFee, tFee); emit Transfer(sender, recipient, tTransferAmount); } function _transferFromExcluded(address sender, address recipient, uint256 tAmount) private { (uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tLiquidity) = _getValues(tAmount); _tOwned[sender] = _tOwned[sender].sub(tAmount); _rOwned[sender] = _rOwned[sender].sub(rAmount); _rOwned[recipient] = _rOwned[recipient].add(rTransferAmount); _takeLiquidity(tLiquidity); _reflectFee(rFee, tFee); emit Transfer(sender, recipient, tTransferAmount); } }
_tokenTransfer
function _tokenTransfer(address sender, address recipient, uint256 amount,bool takeFee) private { if(!takeFee) removeAllFee(); if (_isExcluded[sender] && !_isExcluded[recipient]) { _transferFromExcluded(sender, recipient, amount); } else if (!_isExcluded[sender] && _isExcluded[recipient]) { _transferToExcluded(sender, recipient, amount); } else if (!_isExcluded[sender] && !_isExcluded[recipient]) { _transferStandard(sender, recipient, amount); } else if (_isExcluded[sender] && _isExcluded[recipient]) { _transferBothExcluded(sender, recipient, amount); } else { _transferStandard(sender, recipient, amount); } if(!takeFee) restoreAllFee(); }
//this method is responsible for taking all fee, if takeFee is true
LineComment
v0.6.12+commit.27d51765
None
ipfs://dc2ef5f183a3408ddfd271dfdddd9f9ea17de1f5c07a47614436fba036f0931b
{ "func_code_index": [ 15658, 16481 ] }
1,037
Token
Token.sol
0x8b80596660f007342dc590e5c53bbddd2cd550fb
Solidity
Token
contract Token is ERC20Interface, Owned { using SafeMath for uint256; string public symbol = "FRMS"; string public name = "The Forms"; uint256 public decimals = 18; uint256 private _totalSupply = 5898277 * 10 ** (decimals); mapping(address => uint256) balances; mapping(address => mapping(address => uint256)) allowed; address constant private TEAM = 0x24B73DC219196a5E373D73b7Cd638017f1f07E2F; address constant private MARKETING_FUNDS = 0x4B63B18b66Fc617B5A3125F0ABB565Dc22d732ba ; address constant private COMMUNITY_REWARD = 0xC071C603238F387E48Ee96826a81D608e304545A; address constant private PRIVATE_SALE_ADD1 = 0xB5Aceaa4db96d6901b492505170Ab7F1d6E7cdAd; address constant private PRIVATE_SALE_ADD2 = 0x8f63Fe51A3677cf02C80c11933De4B5846f2a336; address constant private PRIVATE_SALE_ADD3 = 0x134D97378Ed04eC0CaE4C689800Be9e96D683ac1; struct LOCKING{ uint256 lockedTokens; //DR , //PRC uint256 releasePeriod; uint256 cliff; //DR, PRC uint256 lastVisit; uint256 releasePercentage; bool directRelease; //DR } mapping(address => LOCKING) public walletsLocking; // ------------------------------------------------------------------------ // Constructor // ------------------------------------------------------------------------ constructor() public { owner = 0xA6a3E445E613FF022a3001091C7bE274B6a409B0; _tokenAllocation(); _setLocking(); saleOneAllocationsLocking(); saleTwoAllocationsLocking(); saleThreeAllocations(); } function _tokenAllocation() private { // send funds to team _allocate(TEAM, 1303625 ); // send funds to community reward _allocate(COMMUNITY_REWARD,1117393 ); // send funds to marketing funds _allocate(MARKETING_FUNDS, 964572); // send funds to owner for uniswap liquidity _allocate(owner, 354167 ); // Send to private sale addresses 1 _allocate(0xB5Aceaa4db96d6901b492505170Ab7F1d6E7cdAd, 529131); // Send to private sale addresses 2 _allocate(0x8f63Fe51A3677cf02C80c11933De4B5846f2a336, 242718 ); // Send to private sale addresses 3 _allocate(0x134D97378Ed04eC0CaE4C689800Be9e96D683ac1, 252427 ); } function _setLocking() private{ //////////////////////////////////TEAM//////////////////////////////////// walletsLocking[TEAM].directRelease = true; walletsLocking[TEAM].lockedTokens = 1303625 * 10 ** (decimals); walletsLocking[TEAM].cliff = block.timestamp.add(365 days); //////////////////////////////////PRIVATE SALE ADDRESS 1//////////////////////////////////// /////////////////////////////0xB5Aceaa4db96d6901b492505170Ab7F1d6E7cdAd//////////////////// walletsLocking[0xB5Aceaa4db96d6901b492505170Ab7F1d6E7cdAd].directRelease = true; walletsLocking[0xB5Aceaa4db96d6901b492505170Ab7F1d6E7cdAd].lockedTokens = 529131 * 10 ** (decimals); walletsLocking[0xB5Aceaa4db96d6901b492505170Ab7F1d6E7cdAd].cliff = block.timestamp.add(180 days); //////////////////////////////////PRIVATE SALE ADDRESS 2//////////////////////////////////// /////////////////////////////0x8f63Fe51A3677cf02C80c11933De4B5846f2a336//////////////////// walletsLocking[0x8f63Fe51A3677cf02C80c11933De4B5846f2a336].directRelease = true; walletsLocking[0x8f63Fe51A3677cf02C80c11933De4B5846f2a336].lockedTokens = 242718 * 10 ** (decimals); walletsLocking[0x8f63Fe51A3677cf02C80c11933De4B5846f2a336].cliff = block.timestamp.add(180 days); //////////////////////////////////PRIVATE SALE ADDRESS 3//////////////////////////////////// /////////////////////////////0x134D97378Ed04eC0CaE4C689800Be9e96D683ac1//////////////////// walletsLocking[0x134D97378Ed04eC0CaE4C689800Be9e96D683ac1].directRelease = true; walletsLocking[0x134D97378Ed04eC0CaE4C689800Be9e96D683ac1].lockedTokens = 252427 * 10 ** (decimals); walletsLocking[0x134D97378Ed04eC0CaE4C689800Be9e96D683ac1].cliff = block.timestamp.add(180 days); //////////////////////////////////COMMUNITY_REWARD//////////////////////////////////// walletsLocking[COMMUNITY_REWARD].directRelease = false; walletsLocking[COMMUNITY_REWARD].lockedTokens = 1117393 * 10 ** (decimals); walletsLocking[COMMUNITY_REWARD].cliff = block.timestamp.add(30 days); walletsLocking[COMMUNITY_REWARD].lastVisit = block.timestamp.add(30 days); walletsLocking[COMMUNITY_REWARD].releasePeriod = 30 days; // 1 month walletsLocking[COMMUNITY_REWARD].releasePercentage = 5586965e16; // 55869.65 //////////////////////////////////MARKETING_FUNDS//////////////////////////////////// walletsLocking[MARKETING_FUNDS].directRelease = false; walletsLocking[MARKETING_FUNDS].lockedTokens = 7716576e17; // 771657.6 walletsLocking[MARKETING_FUNDS].cliff = block.timestamp; walletsLocking[MARKETING_FUNDS].lastVisit = block.timestamp; walletsLocking[MARKETING_FUNDS].releasePeriod = 30 days; // 1 month walletsLocking[MARKETING_FUNDS].releasePercentage = 1929144e17; // 192914.4 } function saleThreeAllocations() private { _allocate(0x2488f090656BddB63fe3Bdb506D0D109AaaD93Bb,58590); _allocate(0xD7a98d34CD49dd203cAc9752Ea400Ee309A5F602,46872 ); _allocate(0x7b88aD278Cd11506661516E544EcAA9e39F03aF0,39060 ); _allocate(0xc77c3EfB55bd7b0E44c13EB27eb33c98597f0a68,39060 ); _allocate(0x42D455B219214FDA88aF47786CC6e3B5f9a19c37,27342 ); _allocate(0x42D455B219214FDA88aF47786CC6e3B5f9a19c37,19530 ); _allocate(0x42D455B219214FDA88aF47786CC6e3B5f9a19c37,19530 ); _allocate(0xd4Bc360cFDd35e8025dA8237A49D80Fdfb8E351e,17577 ); _allocate(0x707D048708802Dc7730C722F8886105Ff07f0331,15624 ); _allocate(0xfcd987b0D6656c1c84EF73da18c6596D42a73c5E,15624 ); _allocate(0xa38B4f096Ef6323736D26BF6F9a9Ce1dd2257732,15624 ); _allocate(0x4b1bA9aA4337e65ffA2155b92BaFd8E177E73CB5,11718 ); _allocate(0xE8E61Db7918bD88E5ff764Ad5393e87D7AaEf9aD,11718 ); _allocate(0x28B7677b86be88d432775f1c808a33957f6833BE,11718 ); _allocate(0x65E27aD821D14E3567E97eb600728d2AAc7e1be4,11718 ); _allocate(0xDa892C1700147079d0bDeafB7b566E77315f98A4,11718 ); _allocate(0xb0B743639224d2c82c857E6a504daA207e385Dba,8203 ); _allocate(0xfce0413BAD4E59f55946669E678EccFe87777777,7812 ); _allocate(0x78782592D452e92fFFAB8e145201108e97cE36b6,7812 ); _allocate(0x78782592D452e92fFFAB8e145201108e97cE36b6,7812 ); _allocate(0x1e36795b5168E574b6EF0f0461CC4026251C533E,7812 ); _allocate(0x81aA6141923Ea42fCAa763d9857418224d9b025a,7812 ); _allocate(0xf470bbfeaB9B0d60e21FBd611C5d569df20704CE,7812 ); _allocate(0x31E985b4f7af6B479148d260309B7BcEcEF0fa7B,7812 ); _allocate(0x707D048708802Dc7730C722F8886105Ff07f0331,7812 ); _allocate(0xf2d2a2831f411F5cE863E8f836481dB0b40c03A5,7812 ); _allocate(0x716C9cC35607040f54b9232D35a2871F46894F58,6000 ); _allocate(0x81724bCe3D755AEB716d030cbD2c0f5b9f508Df0,5000 ); _allocate(0xE8CC2a8540C7339430859b8E7902AF2fE2d91865,4687 ); _allocate(0x268e1fEE56498Cc24758864AA092F870e8220f74,3906 ); _allocate(0xF93eD4Fe97eB8A2508D03222a28E332F1C89B0eD,3906 ); _allocate(0x65E27aD821D14E3567E97eb600728d2AAc7e1be4,3906 ); _allocate(0x001C88d92d199C9EB936Ed3D6758da7C48e4D08e,3906 ); _allocate(0x42c6Be1400578B238aCd8946FE9682E650DfdE8D,3906 ); _allocate(0x65E27aD821D14E3567E97eb600728d2AAc7e1be4,3906 ); _allocate(0xAcb272Eac895FA57394747615fCb068b8858AAF2,3906 ); _allocate(0x21eDE22Cb8Ab64F4F74128f3D0250a7851971A33,3906 ); _allocate(0x3DFf997410D94E2E3C961F805b85eB2Ef80622c5,3906 ); _allocate(0x8F70b3aC45A6896532FB90B992D5B7827bA88d3C,3906 ); _allocate(0xef6D6a51900B5cf220Fe54F8309B6Eda32e794E9,3906 ); _allocate(0x52BF55C77C402F90dF3Bc1d9E6a0faf262437ab1,3906 ); _allocate(0xa2639Ef1e7956b242E2C5Ac87b72B077FEbe2783,3906 ); _allocate(0x716C9cC35607040f54b9232D35a2871F46894F58,3906 ); _allocate(0x5826914A6223053038328ab3bc7CEB64db04DDc4,3515 ); _allocate(0x896Fa945c5533631F8DaFE7483FeA6859537cfD0,3125 ); _allocate(0x2d5304bA4f2c6EFF5D53CecF64AF89818A416cB9,3125 ); _allocate(0xD53354D4Fb7BcE81Cd4F83c457dbd5EF655C9E93,2734 ); _allocate(0x49216a6434B75051e9063E99Bb486bc85B0b0605,1953 ); _allocate(0xD53354D4Fb7BcE81Cd4F83c457dbd5EF655C9E93,1953 ); _allocate(0x4CEa5d86Bb0bBFa77CB452CCBD52e76dEA4dE045,1627 ); _allocate(0xC274362c1E85834Eb8387C18168C01aaEe2B00d7,1562 ); _allocate(0x18A8e216c3406dED40438856B45198B3ce39e522,1367 ); _allocate(0x51B3954e185869FB4cb9D2Bf9Fbd00A22900E800,477 ); } function saleOneAllocationsLocking() private { uint256 lockingPeriod = 24 hours; _allocateLock(0xCCa178a04D83Af193330C7927fb9a42212Fb1C25, 85932, lockingPeriod); _allocateLock(0xD7d7d68E4BDCf85c073485aB7Bfd151B0C019F1F, 39060, lockingPeriod); _allocateLock(0xf470bbfeaB9B0d60e21FBd611C5d569df20704CE, 31248, lockingPeriod); _allocateLock(0x9022BC8774AebC343De33423570b5285981bd9E1, 31248, lockingPeriod); _allocateLock(0xcf9Bb70b2f1aCCb846e8B0C665a1Ab5D5D35cA05, 31248, lockingPeriod); _allocateLock(0xfce0413BAD4E59f55946669E678EccFe87777777, 23436, lockingPeriod); _allocateLock(0xf470bbfeaB9B0d60e21FBd611C5d569df20704CE, 23436, lockingPeriod); _allocateLock(0xfEeA4Cd7a96dCffBDc6d2e6c814eb4544ab62667, 23436, lockingPeriod); _allocateLock(0xb4A0563DE6ABeE9C3C0631FbAE3444F012a40dB5, 19530, lockingPeriod); _allocateLock(0x54a9bB530474d287202Da7f4d5c9756E13f699f3, 15624, lockingPeriod); _allocateLock(0xEad249D58E4ebbFBf4ABbeCc1201bD88E50f7967, 15624, lockingPeriod); _allocateLock(0x3Dd4234DaeefBaBCeAA6068C04C3f75F19aa2cdA, 15624, lockingPeriod); _allocateLock(0x88F7541D87b7f3c88115A5b2387587263c5d4C7E, 11718, lockingPeriod); _allocateLock(0xf3e4D991a20043b6Bd025058CF4d96Fd7501070b, 11718, lockingPeriod); _allocateLock(0xEc315068A71458FB1A6cC063E9BC7369EC41a7a5, 8593, lockingPeriod); _allocateLock(0x54a9bB530474d287202Da7f4d5c9756E13f699f3, 7812, lockingPeriod); _allocateLock(0x0fEB352cfd10314af9abCF4eD03Da9311Bf8bC44, 7812, lockingPeriod); _allocateLock(0xd28932b8d4Be295D4B90b514EFa3E80436d66bEC, 7812, lockingPeriod); _allocateLock(0x268e1fEE56498Cc24758864AA092F870e8220f74, 7812, lockingPeriod); _allocateLock(0xDFF214084Fee648c8e0bc0838C1fa5E8548F58aC, 7812, lockingPeriod); _allocateLock(0x4356DdB30910c1f9b3Aa1e6A60111CE9802B6dF9, 7812, lockingPeriod); _allocateLock(0x863A3bD6f28f4F4A131c88708dA91076fDC362C7, 7812, lockingPeriod); _allocateLock(0x3F79B63823E435FaF08A95e0973b389333B19b99, 7812, lockingPeriod); _allocateLock(0x8F70b3aC45A6896532FB90B992D5B7827bA88d3C, 7812, lockingPeriod); _allocateLock(0xEc315068A71458FB1A6cC063E9BC7369EC41a7a5, 6640, lockingPeriod); _allocateLock(0x138EcD97Da1C9484263BfADDc1f3D6AE2a435bCb, 6250, lockingPeriod); _allocateLock(0x53A07d3c1Fdc58c0Cfd2c96817D9537A9E113dd4, 5468, lockingPeriod); _allocateLock(0xCEC0971e55A4C39e3e2C4d8f175CC6e53c138B0A, 4297, lockingPeriod); _allocateLock(0xBA682E593784f7654e4F92D58213dc495f229Eec, 3906, lockingPeriod); _allocateLock(0x9B9e35C223B39f908A036E41011D9E3aDb06ae0B, 3906, lockingPeriod); _allocateLock(0xBA98b69a140c078746219D0bBf0bb3b923483374, 3906, lockingPeriod); _allocateLock(0x34c4E14243a95b148534f894FCe86c61bC9F731a, 3906, lockingPeriod); _allocateLock(0x9A61567A3e3c5b47DFFB0670C629A40533Eb84d5, 3906, lockingPeriod); _allocateLock(0xda90dDbbdd4e0237C6889367c1556179c817680B, 3567, lockingPeriod); _allocateLock(0x329318Ca294A2d127e43058A7b23ED514B503d76, 2734, lockingPeriod); _allocateLock(0x7B3fC9597f146F0A80FC26dB0DdF62C04ea89740, 2578, lockingPeriod); _allocateLock(0xb6eC0d0172BC4Cff8fF669b543e03c2c8B64Fc5E, 2344, lockingPeriod); _allocateLock(0x53A07d3c1Fdc58c0Cfd2c96817D9537A9E113dd4, 2344, lockingPeriod); } function saleTwoAllocationsLocking() private { uint256 lockingPeriod = 12 hours; _allocateLock(0xc77c3EfB55bd7b0E44c13EB27eb33c98597f0a68, 16758, lockingPeriod); _allocateLock(0x9E817382A12D2b1D15246c4d383bEB8171BCdfA9, 13965, lockingPeriod); _allocateLock(0xfF6735CFf3DFED5d68dC3DbeBb0d34c5e815BA09, 11172, lockingPeriod); _allocateLock(0x5400087152e436C7C22883d01911868A3C892551, 7820, lockingPeriod); _allocateLock(0x974896E96219Dd508100f2Ad58921290655072aD, 5586, lockingPeriod); _allocateLock(0x0fEB352cfd10314af9abCF4eD03Da9311Bf8bC44, 5586, lockingPeriod); _allocateLock(0x268e1fEE56498Cc24758864AA092F870e8220f74, 5586, lockingPeriod); _allocateLock(0xC274362c1E85834Eb8387C18168C01aaEe2B00d7, 4469, lockingPeriod); _allocateLock(0x93935316db093A8665E91EE932591F76bf8E5295, 3631, lockingPeriod); _allocateLock(0x8bdBF4B19cb840e9Ac9B1eFFc2BfAd47591B5bF2, 2793, lockingPeriod); } function _allocateLock(address user, uint256 tokens, uint256 lockingPeriod) private{ uint256 startTime = 1599253200; // 4 sep walletsLocking[user].directRelease = true; walletsLocking[user].lockedTokens = tokens * 10 ** (decimals); walletsLocking[user].cliff = startTime.add(lockingPeriod); _allocate(user, tokens); } function _allocate(address user, uint256 tokens) private { balances[user] = balances[user].add(tokens * 10 ** (decimals)); emit Transfer(address(0),user, tokens * 10 ** (decimals)); } /** ERC20Interface function's implementation **/ function totalSupply() public override view returns (uint256){ return _totalSupply; } // ------------------------------------------------------------------------ // Get the token balance for account `tokenOwner` // ------------------------------------------------------------------------ function balanceOf(address tokenOwner) public override view returns (uint256 balance) { return balances[tokenOwner]; } // ------------------------------------------------------------------------ // Transfer the balance from token owner's account to `to` account // - Owner's account must have sufficient balance to transfer // - 0 value transfers are allowed // ------------------------------------------------------------------------ function transfer(address to, uint256 tokens) public override returns (bool success) { // prevent transfer to 0x0, use burn instead require(address(to) != address(0), "Transfer to address 0 not allowed"); require(balances[msg.sender] >= tokens, "SENDER: insufficient balance"); if (walletsLocking[msg.sender].lockedTokens > 0 ){ if(walletsLocking[msg.sender].directRelease) directRelease(msg.sender); else checkTime(msg.sender); } require(balances[msg.sender].sub(tokens) >= walletsLocking[msg.sender].lockedTokens, "Please wait for tokens to be released"); balances[msg.sender] = balances[msg.sender].sub(tokens); balances[to] = balances[to].add(tokens); emit Transfer(msg.sender, to, tokens); return true; } // ------------------------------------------------------------------------ // Token owner can approve for `spender` to transferFrom(...) `tokens` // from the token owner's account // ------------------------------------------------------------------------ function approve(address spender, uint256 tokens) public override returns (bool success){ allowed[msg.sender][spender] = tokens; emit Approval(msg.sender,spender,tokens); return true; } // ------------------------------------------------------------------------ // Transfer `tokens` from the `from` account to the `to` account // // The calling account must already have sufficient tokens approve(...)-d // for spending from the `from` account and // - From account must have sufficient balance to transfer // - Spender must have sufficient allowance to transfer // - 0 value transfers are allowed // ------------------------------------------------------------------------ function transferFrom(address from, address to, uint256 tokens) public override returns (bool success){ require(tokens <= allowed[from][msg.sender]); //check allowance // prevent transfer to 0x0, use burn instead require(address(to) != address(0), "Transfer to address 0 not allowed"); require(address(from) != address(0), "Transfer from address 0 not allowed"); require(balances[from] >= tokens, "SENDER: Insufficient balance"); if (walletsLocking[from].lockedTokens > 0){ if(walletsLocking[from].directRelease) directRelease(from); else checkTime(from); } require(balances[from].sub(tokens) >= walletsLocking[from].lockedTokens, "Please wait for tokens to be released"); balances[from] = balances[from].sub(tokens); balances[to] = balances[to].add(tokens); allowed[from][msg.sender] = allowed[from][msg.sender].sub(tokens); emit Transfer(from,to,tokens); return true; } // ------------------------------------------------------------------------ // Returns the amount of tokens approved by the owner that can be // transferred to the spender's account // ------------------------------------------------------------------------ function allowance(address tokenOwner, address spender) public override view returns (uint256 remaining) { return allowed[tokenOwner][spender]; } // ------------------------------------------------------------------------ // @dev Internal function that burns an amount of the token from a given account // @param _amount The amount that will be burnt // @param _account The tokens to burn from // can be used from account owner or contract owner // ------------------------------------------------------------------------ function burnTokens(uint256 _amount, address _account) public { require(msg.sender == _account || msg.sender == owner, "UnAuthorized"); require(balances[_account] >= _amount, "Insufficient account balance"); _totalSupply = _totalSupply.sub(_amount); balances[_account] = balances[_account].sub(_amount); emit Transfer(_account, address(0), _amount); } function directRelease(address _wallet) private{ if(block.timestamp > walletsLocking[_wallet].cliff){ walletsLocking[_wallet].lockedTokens = 0; } } function checkTime(address _wallet) private { // if cliff is applied if(block.timestamp > walletsLocking[_wallet].cliff){ uint256 timeSpanned = (now.sub(walletsLocking[_wallet].lastVisit)).div(walletsLocking[_wallet].releasePeriod); // if release period is passed if (timeSpanned >= 1){ uint256 released = timeSpanned.mul(walletsLocking[_wallet].releasePercentage); if (released > walletsLocking[_wallet].lockedTokens){ released = walletsLocking[_wallet].lockedTokens; } walletsLocking[_wallet].lastVisit = now; walletsLocking[_wallet].lockedTokens = walletsLocking[_wallet].lockedTokens.sub(released); } } } }
// ---------------------------------------------------------------------------- // ERC20 Token, with the addition of symbol, name and decimals and assisted // token transfers // ----------------------------------------------------------------------------
LineComment
totalSupply
function totalSupply() public override view returns (uint256){ return _totalSupply; }
/** ERC20Interface function's implementation **/
NatSpecMultiLine
v0.6.6+commit.6c089d02
Unlicense
ipfs://10e7056ffdb36de8e87f8f571f3b72a1fb3c1fd831e1b8ae606289c735dea39d
{ "func_code_index": [ 15368, 15471 ] }
1,038
Token
Token.sol
0x8b80596660f007342dc590e5c53bbddd2cd550fb
Solidity
Token
contract Token is ERC20Interface, Owned { using SafeMath for uint256; string public symbol = "FRMS"; string public name = "The Forms"; uint256 public decimals = 18; uint256 private _totalSupply = 5898277 * 10 ** (decimals); mapping(address => uint256) balances; mapping(address => mapping(address => uint256)) allowed; address constant private TEAM = 0x24B73DC219196a5E373D73b7Cd638017f1f07E2F; address constant private MARKETING_FUNDS = 0x4B63B18b66Fc617B5A3125F0ABB565Dc22d732ba ; address constant private COMMUNITY_REWARD = 0xC071C603238F387E48Ee96826a81D608e304545A; address constant private PRIVATE_SALE_ADD1 = 0xB5Aceaa4db96d6901b492505170Ab7F1d6E7cdAd; address constant private PRIVATE_SALE_ADD2 = 0x8f63Fe51A3677cf02C80c11933De4B5846f2a336; address constant private PRIVATE_SALE_ADD3 = 0x134D97378Ed04eC0CaE4C689800Be9e96D683ac1; struct LOCKING{ uint256 lockedTokens; //DR , //PRC uint256 releasePeriod; uint256 cliff; //DR, PRC uint256 lastVisit; uint256 releasePercentage; bool directRelease; //DR } mapping(address => LOCKING) public walletsLocking; // ------------------------------------------------------------------------ // Constructor // ------------------------------------------------------------------------ constructor() public { owner = 0xA6a3E445E613FF022a3001091C7bE274B6a409B0; _tokenAllocation(); _setLocking(); saleOneAllocationsLocking(); saleTwoAllocationsLocking(); saleThreeAllocations(); } function _tokenAllocation() private { // send funds to team _allocate(TEAM, 1303625 ); // send funds to community reward _allocate(COMMUNITY_REWARD,1117393 ); // send funds to marketing funds _allocate(MARKETING_FUNDS, 964572); // send funds to owner for uniswap liquidity _allocate(owner, 354167 ); // Send to private sale addresses 1 _allocate(0xB5Aceaa4db96d6901b492505170Ab7F1d6E7cdAd, 529131); // Send to private sale addresses 2 _allocate(0x8f63Fe51A3677cf02C80c11933De4B5846f2a336, 242718 ); // Send to private sale addresses 3 _allocate(0x134D97378Ed04eC0CaE4C689800Be9e96D683ac1, 252427 ); } function _setLocking() private{ //////////////////////////////////TEAM//////////////////////////////////// walletsLocking[TEAM].directRelease = true; walletsLocking[TEAM].lockedTokens = 1303625 * 10 ** (decimals); walletsLocking[TEAM].cliff = block.timestamp.add(365 days); //////////////////////////////////PRIVATE SALE ADDRESS 1//////////////////////////////////// /////////////////////////////0xB5Aceaa4db96d6901b492505170Ab7F1d6E7cdAd//////////////////// walletsLocking[0xB5Aceaa4db96d6901b492505170Ab7F1d6E7cdAd].directRelease = true; walletsLocking[0xB5Aceaa4db96d6901b492505170Ab7F1d6E7cdAd].lockedTokens = 529131 * 10 ** (decimals); walletsLocking[0xB5Aceaa4db96d6901b492505170Ab7F1d6E7cdAd].cliff = block.timestamp.add(180 days); //////////////////////////////////PRIVATE SALE ADDRESS 2//////////////////////////////////// /////////////////////////////0x8f63Fe51A3677cf02C80c11933De4B5846f2a336//////////////////// walletsLocking[0x8f63Fe51A3677cf02C80c11933De4B5846f2a336].directRelease = true; walletsLocking[0x8f63Fe51A3677cf02C80c11933De4B5846f2a336].lockedTokens = 242718 * 10 ** (decimals); walletsLocking[0x8f63Fe51A3677cf02C80c11933De4B5846f2a336].cliff = block.timestamp.add(180 days); //////////////////////////////////PRIVATE SALE ADDRESS 3//////////////////////////////////// /////////////////////////////0x134D97378Ed04eC0CaE4C689800Be9e96D683ac1//////////////////// walletsLocking[0x134D97378Ed04eC0CaE4C689800Be9e96D683ac1].directRelease = true; walletsLocking[0x134D97378Ed04eC0CaE4C689800Be9e96D683ac1].lockedTokens = 252427 * 10 ** (decimals); walletsLocking[0x134D97378Ed04eC0CaE4C689800Be9e96D683ac1].cliff = block.timestamp.add(180 days); //////////////////////////////////COMMUNITY_REWARD//////////////////////////////////// walletsLocking[COMMUNITY_REWARD].directRelease = false; walletsLocking[COMMUNITY_REWARD].lockedTokens = 1117393 * 10 ** (decimals); walletsLocking[COMMUNITY_REWARD].cliff = block.timestamp.add(30 days); walletsLocking[COMMUNITY_REWARD].lastVisit = block.timestamp.add(30 days); walletsLocking[COMMUNITY_REWARD].releasePeriod = 30 days; // 1 month walletsLocking[COMMUNITY_REWARD].releasePercentage = 5586965e16; // 55869.65 //////////////////////////////////MARKETING_FUNDS//////////////////////////////////// walletsLocking[MARKETING_FUNDS].directRelease = false; walletsLocking[MARKETING_FUNDS].lockedTokens = 7716576e17; // 771657.6 walletsLocking[MARKETING_FUNDS].cliff = block.timestamp; walletsLocking[MARKETING_FUNDS].lastVisit = block.timestamp; walletsLocking[MARKETING_FUNDS].releasePeriod = 30 days; // 1 month walletsLocking[MARKETING_FUNDS].releasePercentage = 1929144e17; // 192914.4 } function saleThreeAllocations() private { _allocate(0x2488f090656BddB63fe3Bdb506D0D109AaaD93Bb,58590); _allocate(0xD7a98d34CD49dd203cAc9752Ea400Ee309A5F602,46872 ); _allocate(0x7b88aD278Cd11506661516E544EcAA9e39F03aF0,39060 ); _allocate(0xc77c3EfB55bd7b0E44c13EB27eb33c98597f0a68,39060 ); _allocate(0x42D455B219214FDA88aF47786CC6e3B5f9a19c37,27342 ); _allocate(0x42D455B219214FDA88aF47786CC6e3B5f9a19c37,19530 ); _allocate(0x42D455B219214FDA88aF47786CC6e3B5f9a19c37,19530 ); _allocate(0xd4Bc360cFDd35e8025dA8237A49D80Fdfb8E351e,17577 ); _allocate(0x707D048708802Dc7730C722F8886105Ff07f0331,15624 ); _allocate(0xfcd987b0D6656c1c84EF73da18c6596D42a73c5E,15624 ); _allocate(0xa38B4f096Ef6323736D26BF6F9a9Ce1dd2257732,15624 ); _allocate(0x4b1bA9aA4337e65ffA2155b92BaFd8E177E73CB5,11718 ); _allocate(0xE8E61Db7918bD88E5ff764Ad5393e87D7AaEf9aD,11718 ); _allocate(0x28B7677b86be88d432775f1c808a33957f6833BE,11718 ); _allocate(0x65E27aD821D14E3567E97eb600728d2AAc7e1be4,11718 ); _allocate(0xDa892C1700147079d0bDeafB7b566E77315f98A4,11718 ); _allocate(0xb0B743639224d2c82c857E6a504daA207e385Dba,8203 ); _allocate(0xfce0413BAD4E59f55946669E678EccFe87777777,7812 ); _allocate(0x78782592D452e92fFFAB8e145201108e97cE36b6,7812 ); _allocate(0x78782592D452e92fFFAB8e145201108e97cE36b6,7812 ); _allocate(0x1e36795b5168E574b6EF0f0461CC4026251C533E,7812 ); _allocate(0x81aA6141923Ea42fCAa763d9857418224d9b025a,7812 ); _allocate(0xf470bbfeaB9B0d60e21FBd611C5d569df20704CE,7812 ); _allocate(0x31E985b4f7af6B479148d260309B7BcEcEF0fa7B,7812 ); _allocate(0x707D048708802Dc7730C722F8886105Ff07f0331,7812 ); _allocate(0xf2d2a2831f411F5cE863E8f836481dB0b40c03A5,7812 ); _allocate(0x716C9cC35607040f54b9232D35a2871F46894F58,6000 ); _allocate(0x81724bCe3D755AEB716d030cbD2c0f5b9f508Df0,5000 ); _allocate(0xE8CC2a8540C7339430859b8E7902AF2fE2d91865,4687 ); _allocate(0x268e1fEE56498Cc24758864AA092F870e8220f74,3906 ); _allocate(0xF93eD4Fe97eB8A2508D03222a28E332F1C89B0eD,3906 ); _allocate(0x65E27aD821D14E3567E97eb600728d2AAc7e1be4,3906 ); _allocate(0x001C88d92d199C9EB936Ed3D6758da7C48e4D08e,3906 ); _allocate(0x42c6Be1400578B238aCd8946FE9682E650DfdE8D,3906 ); _allocate(0x65E27aD821D14E3567E97eb600728d2AAc7e1be4,3906 ); _allocate(0xAcb272Eac895FA57394747615fCb068b8858AAF2,3906 ); _allocate(0x21eDE22Cb8Ab64F4F74128f3D0250a7851971A33,3906 ); _allocate(0x3DFf997410D94E2E3C961F805b85eB2Ef80622c5,3906 ); _allocate(0x8F70b3aC45A6896532FB90B992D5B7827bA88d3C,3906 ); _allocate(0xef6D6a51900B5cf220Fe54F8309B6Eda32e794E9,3906 ); _allocate(0x52BF55C77C402F90dF3Bc1d9E6a0faf262437ab1,3906 ); _allocate(0xa2639Ef1e7956b242E2C5Ac87b72B077FEbe2783,3906 ); _allocate(0x716C9cC35607040f54b9232D35a2871F46894F58,3906 ); _allocate(0x5826914A6223053038328ab3bc7CEB64db04DDc4,3515 ); _allocate(0x896Fa945c5533631F8DaFE7483FeA6859537cfD0,3125 ); _allocate(0x2d5304bA4f2c6EFF5D53CecF64AF89818A416cB9,3125 ); _allocate(0xD53354D4Fb7BcE81Cd4F83c457dbd5EF655C9E93,2734 ); _allocate(0x49216a6434B75051e9063E99Bb486bc85B0b0605,1953 ); _allocate(0xD53354D4Fb7BcE81Cd4F83c457dbd5EF655C9E93,1953 ); _allocate(0x4CEa5d86Bb0bBFa77CB452CCBD52e76dEA4dE045,1627 ); _allocate(0xC274362c1E85834Eb8387C18168C01aaEe2B00d7,1562 ); _allocate(0x18A8e216c3406dED40438856B45198B3ce39e522,1367 ); _allocate(0x51B3954e185869FB4cb9D2Bf9Fbd00A22900E800,477 ); } function saleOneAllocationsLocking() private { uint256 lockingPeriod = 24 hours; _allocateLock(0xCCa178a04D83Af193330C7927fb9a42212Fb1C25, 85932, lockingPeriod); _allocateLock(0xD7d7d68E4BDCf85c073485aB7Bfd151B0C019F1F, 39060, lockingPeriod); _allocateLock(0xf470bbfeaB9B0d60e21FBd611C5d569df20704CE, 31248, lockingPeriod); _allocateLock(0x9022BC8774AebC343De33423570b5285981bd9E1, 31248, lockingPeriod); _allocateLock(0xcf9Bb70b2f1aCCb846e8B0C665a1Ab5D5D35cA05, 31248, lockingPeriod); _allocateLock(0xfce0413BAD4E59f55946669E678EccFe87777777, 23436, lockingPeriod); _allocateLock(0xf470bbfeaB9B0d60e21FBd611C5d569df20704CE, 23436, lockingPeriod); _allocateLock(0xfEeA4Cd7a96dCffBDc6d2e6c814eb4544ab62667, 23436, lockingPeriod); _allocateLock(0xb4A0563DE6ABeE9C3C0631FbAE3444F012a40dB5, 19530, lockingPeriod); _allocateLock(0x54a9bB530474d287202Da7f4d5c9756E13f699f3, 15624, lockingPeriod); _allocateLock(0xEad249D58E4ebbFBf4ABbeCc1201bD88E50f7967, 15624, lockingPeriod); _allocateLock(0x3Dd4234DaeefBaBCeAA6068C04C3f75F19aa2cdA, 15624, lockingPeriod); _allocateLock(0x88F7541D87b7f3c88115A5b2387587263c5d4C7E, 11718, lockingPeriod); _allocateLock(0xf3e4D991a20043b6Bd025058CF4d96Fd7501070b, 11718, lockingPeriod); _allocateLock(0xEc315068A71458FB1A6cC063E9BC7369EC41a7a5, 8593, lockingPeriod); _allocateLock(0x54a9bB530474d287202Da7f4d5c9756E13f699f3, 7812, lockingPeriod); _allocateLock(0x0fEB352cfd10314af9abCF4eD03Da9311Bf8bC44, 7812, lockingPeriod); _allocateLock(0xd28932b8d4Be295D4B90b514EFa3E80436d66bEC, 7812, lockingPeriod); _allocateLock(0x268e1fEE56498Cc24758864AA092F870e8220f74, 7812, lockingPeriod); _allocateLock(0xDFF214084Fee648c8e0bc0838C1fa5E8548F58aC, 7812, lockingPeriod); _allocateLock(0x4356DdB30910c1f9b3Aa1e6A60111CE9802B6dF9, 7812, lockingPeriod); _allocateLock(0x863A3bD6f28f4F4A131c88708dA91076fDC362C7, 7812, lockingPeriod); _allocateLock(0x3F79B63823E435FaF08A95e0973b389333B19b99, 7812, lockingPeriod); _allocateLock(0x8F70b3aC45A6896532FB90B992D5B7827bA88d3C, 7812, lockingPeriod); _allocateLock(0xEc315068A71458FB1A6cC063E9BC7369EC41a7a5, 6640, lockingPeriod); _allocateLock(0x138EcD97Da1C9484263BfADDc1f3D6AE2a435bCb, 6250, lockingPeriod); _allocateLock(0x53A07d3c1Fdc58c0Cfd2c96817D9537A9E113dd4, 5468, lockingPeriod); _allocateLock(0xCEC0971e55A4C39e3e2C4d8f175CC6e53c138B0A, 4297, lockingPeriod); _allocateLock(0xBA682E593784f7654e4F92D58213dc495f229Eec, 3906, lockingPeriod); _allocateLock(0x9B9e35C223B39f908A036E41011D9E3aDb06ae0B, 3906, lockingPeriod); _allocateLock(0xBA98b69a140c078746219D0bBf0bb3b923483374, 3906, lockingPeriod); _allocateLock(0x34c4E14243a95b148534f894FCe86c61bC9F731a, 3906, lockingPeriod); _allocateLock(0x9A61567A3e3c5b47DFFB0670C629A40533Eb84d5, 3906, lockingPeriod); _allocateLock(0xda90dDbbdd4e0237C6889367c1556179c817680B, 3567, lockingPeriod); _allocateLock(0x329318Ca294A2d127e43058A7b23ED514B503d76, 2734, lockingPeriod); _allocateLock(0x7B3fC9597f146F0A80FC26dB0DdF62C04ea89740, 2578, lockingPeriod); _allocateLock(0xb6eC0d0172BC4Cff8fF669b543e03c2c8B64Fc5E, 2344, lockingPeriod); _allocateLock(0x53A07d3c1Fdc58c0Cfd2c96817D9537A9E113dd4, 2344, lockingPeriod); } function saleTwoAllocationsLocking() private { uint256 lockingPeriod = 12 hours; _allocateLock(0xc77c3EfB55bd7b0E44c13EB27eb33c98597f0a68, 16758, lockingPeriod); _allocateLock(0x9E817382A12D2b1D15246c4d383bEB8171BCdfA9, 13965, lockingPeriod); _allocateLock(0xfF6735CFf3DFED5d68dC3DbeBb0d34c5e815BA09, 11172, lockingPeriod); _allocateLock(0x5400087152e436C7C22883d01911868A3C892551, 7820, lockingPeriod); _allocateLock(0x974896E96219Dd508100f2Ad58921290655072aD, 5586, lockingPeriod); _allocateLock(0x0fEB352cfd10314af9abCF4eD03Da9311Bf8bC44, 5586, lockingPeriod); _allocateLock(0x268e1fEE56498Cc24758864AA092F870e8220f74, 5586, lockingPeriod); _allocateLock(0xC274362c1E85834Eb8387C18168C01aaEe2B00d7, 4469, lockingPeriod); _allocateLock(0x93935316db093A8665E91EE932591F76bf8E5295, 3631, lockingPeriod); _allocateLock(0x8bdBF4B19cb840e9Ac9B1eFFc2BfAd47591B5bF2, 2793, lockingPeriod); } function _allocateLock(address user, uint256 tokens, uint256 lockingPeriod) private{ uint256 startTime = 1599253200; // 4 sep walletsLocking[user].directRelease = true; walletsLocking[user].lockedTokens = tokens * 10 ** (decimals); walletsLocking[user].cliff = startTime.add(lockingPeriod); _allocate(user, tokens); } function _allocate(address user, uint256 tokens) private { balances[user] = balances[user].add(tokens * 10 ** (decimals)); emit Transfer(address(0),user, tokens * 10 ** (decimals)); } /** ERC20Interface function's implementation **/ function totalSupply() public override view returns (uint256){ return _totalSupply; } // ------------------------------------------------------------------------ // Get the token balance for account `tokenOwner` // ------------------------------------------------------------------------ function balanceOf(address tokenOwner) public override view returns (uint256 balance) { return balances[tokenOwner]; } // ------------------------------------------------------------------------ // Transfer the balance from token owner's account to `to` account // - Owner's account must have sufficient balance to transfer // - 0 value transfers are allowed // ------------------------------------------------------------------------ function transfer(address to, uint256 tokens) public override returns (bool success) { // prevent transfer to 0x0, use burn instead require(address(to) != address(0), "Transfer to address 0 not allowed"); require(balances[msg.sender] >= tokens, "SENDER: insufficient balance"); if (walletsLocking[msg.sender].lockedTokens > 0 ){ if(walletsLocking[msg.sender].directRelease) directRelease(msg.sender); else checkTime(msg.sender); } require(balances[msg.sender].sub(tokens) >= walletsLocking[msg.sender].lockedTokens, "Please wait for tokens to be released"); balances[msg.sender] = balances[msg.sender].sub(tokens); balances[to] = balances[to].add(tokens); emit Transfer(msg.sender, to, tokens); return true; } // ------------------------------------------------------------------------ // Token owner can approve for `spender` to transferFrom(...) `tokens` // from the token owner's account // ------------------------------------------------------------------------ function approve(address spender, uint256 tokens) public override returns (bool success){ allowed[msg.sender][spender] = tokens; emit Approval(msg.sender,spender,tokens); return true; } // ------------------------------------------------------------------------ // Transfer `tokens` from the `from` account to the `to` account // // The calling account must already have sufficient tokens approve(...)-d // for spending from the `from` account and // - From account must have sufficient balance to transfer // - Spender must have sufficient allowance to transfer // - 0 value transfers are allowed // ------------------------------------------------------------------------ function transferFrom(address from, address to, uint256 tokens) public override returns (bool success){ require(tokens <= allowed[from][msg.sender]); //check allowance // prevent transfer to 0x0, use burn instead require(address(to) != address(0), "Transfer to address 0 not allowed"); require(address(from) != address(0), "Transfer from address 0 not allowed"); require(balances[from] >= tokens, "SENDER: Insufficient balance"); if (walletsLocking[from].lockedTokens > 0){ if(walletsLocking[from].directRelease) directRelease(from); else checkTime(from); } require(balances[from].sub(tokens) >= walletsLocking[from].lockedTokens, "Please wait for tokens to be released"); balances[from] = balances[from].sub(tokens); balances[to] = balances[to].add(tokens); allowed[from][msg.sender] = allowed[from][msg.sender].sub(tokens); emit Transfer(from,to,tokens); return true; } // ------------------------------------------------------------------------ // Returns the amount of tokens approved by the owner that can be // transferred to the spender's account // ------------------------------------------------------------------------ function allowance(address tokenOwner, address spender) public override view returns (uint256 remaining) { return allowed[tokenOwner][spender]; } // ------------------------------------------------------------------------ // @dev Internal function that burns an amount of the token from a given account // @param _amount The amount that will be burnt // @param _account The tokens to burn from // can be used from account owner or contract owner // ------------------------------------------------------------------------ function burnTokens(uint256 _amount, address _account) public { require(msg.sender == _account || msg.sender == owner, "UnAuthorized"); require(balances[_account] >= _amount, "Insufficient account balance"); _totalSupply = _totalSupply.sub(_amount); balances[_account] = balances[_account].sub(_amount); emit Transfer(_account, address(0), _amount); } function directRelease(address _wallet) private{ if(block.timestamp > walletsLocking[_wallet].cliff){ walletsLocking[_wallet].lockedTokens = 0; } } function checkTime(address _wallet) private { // if cliff is applied if(block.timestamp > walletsLocking[_wallet].cliff){ uint256 timeSpanned = (now.sub(walletsLocking[_wallet].lastVisit)).div(walletsLocking[_wallet].releasePeriod); // if release period is passed if (timeSpanned >= 1){ uint256 released = timeSpanned.mul(walletsLocking[_wallet].releasePercentage); if (released > walletsLocking[_wallet].lockedTokens){ released = walletsLocking[_wallet].lockedTokens; } walletsLocking[_wallet].lastVisit = now; walletsLocking[_wallet].lockedTokens = walletsLocking[_wallet].lockedTokens.sub(released); } } } }
// ---------------------------------------------------------------------------- // ERC20 Token, with the addition of symbol, name and decimals and assisted // token transfers // ----------------------------------------------------------------------------
LineComment
balanceOf
function balanceOf(address tokenOwner) public override view returns (uint256 balance) { return balances[tokenOwner]; }
// ------------------------------------------------------------------------ // Get the token balance for account `tokenOwner` // ------------------------------------------------------------------------
LineComment
v0.6.6+commit.6c089d02
Unlicense
ipfs://10e7056ffdb36de8e87f8f571f3b72a1fb3c1fd831e1b8ae606289c735dea39d
{ "func_code_index": [ 15691, 15828 ] }
1,039
Token
Token.sol
0x8b80596660f007342dc590e5c53bbddd2cd550fb
Solidity
Token
contract Token is ERC20Interface, Owned { using SafeMath for uint256; string public symbol = "FRMS"; string public name = "The Forms"; uint256 public decimals = 18; uint256 private _totalSupply = 5898277 * 10 ** (decimals); mapping(address => uint256) balances; mapping(address => mapping(address => uint256)) allowed; address constant private TEAM = 0x24B73DC219196a5E373D73b7Cd638017f1f07E2F; address constant private MARKETING_FUNDS = 0x4B63B18b66Fc617B5A3125F0ABB565Dc22d732ba ; address constant private COMMUNITY_REWARD = 0xC071C603238F387E48Ee96826a81D608e304545A; address constant private PRIVATE_SALE_ADD1 = 0xB5Aceaa4db96d6901b492505170Ab7F1d6E7cdAd; address constant private PRIVATE_SALE_ADD2 = 0x8f63Fe51A3677cf02C80c11933De4B5846f2a336; address constant private PRIVATE_SALE_ADD3 = 0x134D97378Ed04eC0CaE4C689800Be9e96D683ac1; struct LOCKING{ uint256 lockedTokens; //DR , //PRC uint256 releasePeriod; uint256 cliff; //DR, PRC uint256 lastVisit; uint256 releasePercentage; bool directRelease; //DR } mapping(address => LOCKING) public walletsLocking; // ------------------------------------------------------------------------ // Constructor // ------------------------------------------------------------------------ constructor() public { owner = 0xA6a3E445E613FF022a3001091C7bE274B6a409B0; _tokenAllocation(); _setLocking(); saleOneAllocationsLocking(); saleTwoAllocationsLocking(); saleThreeAllocations(); } function _tokenAllocation() private { // send funds to team _allocate(TEAM, 1303625 ); // send funds to community reward _allocate(COMMUNITY_REWARD,1117393 ); // send funds to marketing funds _allocate(MARKETING_FUNDS, 964572); // send funds to owner for uniswap liquidity _allocate(owner, 354167 ); // Send to private sale addresses 1 _allocate(0xB5Aceaa4db96d6901b492505170Ab7F1d6E7cdAd, 529131); // Send to private sale addresses 2 _allocate(0x8f63Fe51A3677cf02C80c11933De4B5846f2a336, 242718 ); // Send to private sale addresses 3 _allocate(0x134D97378Ed04eC0CaE4C689800Be9e96D683ac1, 252427 ); } function _setLocking() private{ //////////////////////////////////TEAM//////////////////////////////////// walletsLocking[TEAM].directRelease = true; walletsLocking[TEAM].lockedTokens = 1303625 * 10 ** (decimals); walletsLocking[TEAM].cliff = block.timestamp.add(365 days); //////////////////////////////////PRIVATE SALE ADDRESS 1//////////////////////////////////// /////////////////////////////0xB5Aceaa4db96d6901b492505170Ab7F1d6E7cdAd//////////////////// walletsLocking[0xB5Aceaa4db96d6901b492505170Ab7F1d6E7cdAd].directRelease = true; walletsLocking[0xB5Aceaa4db96d6901b492505170Ab7F1d6E7cdAd].lockedTokens = 529131 * 10 ** (decimals); walletsLocking[0xB5Aceaa4db96d6901b492505170Ab7F1d6E7cdAd].cliff = block.timestamp.add(180 days); //////////////////////////////////PRIVATE SALE ADDRESS 2//////////////////////////////////// /////////////////////////////0x8f63Fe51A3677cf02C80c11933De4B5846f2a336//////////////////// walletsLocking[0x8f63Fe51A3677cf02C80c11933De4B5846f2a336].directRelease = true; walletsLocking[0x8f63Fe51A3677cf02C80c11933De4B5846f2a336].lockedTokens = 242718 * 10 ** (decimals); walletsLocking[0x8f63Fe51A3677cf02C80c11933De4B5846f2a336].cliff = block.timestamp.add(180 days); //////////////////////////////////PRIVATE SALE ADDRESS 3//////////////////////////////////// /////////////////////////////0x134D97378Ed04eC0CaE4C689800Be9e96D683ac1//////////////////// walletsLocking[0x134D97378Ed04eC0CaE4C689800Be9e96D683ac1].directRelease = true; walletsLocking[0x134D97378Ed04eC0CaE4C689800Be9e96D683ac1].lockedTokens = 252427 * 10 ** (decimals); walletsLocking[0x134D97378Ed04eC0CaE4C689800Be9e96D683ac1].cliff = block.timestamp.add(180 days); //////////////////////////////////COMMUNITY_REWARD//////////////////////////////////// walletsLocking[COMMUNITY_REWARD].directRelease = false; walletsLocking[COMMUNITY_REWARD].lockedTokens = 1117393 * 10 ** (decimals); walletsLocking[COMMUNITY_REWARD].cliff = block.timestamp.add(30 days); walletsLocking[COMMUNITY_REWARD].lastVisit = block.timestamp.add(30 days); walletsLocking[COMMUNITY_REWARD].releasePeriod = 30 days; // 1 month walletsLocking[COMMUNITY_REWARD].releasePercentage = 5586965e16; // 55869.65 //////////////////////////////////MARKETING_FUNDS//////////////////////////////////// walletsLocking[MARKETING_FUNDS].directRelease = false; walletsLocking[MARKETING_FUNDS].lockedTokens = 7716576e17; // 771657.6 walletsLocking[MARKETING_FUNDS].cliff = block.timestamp; walletsLocking[MARKETING_FUNDS].lastVisit = block.timestamp; walletsLocking[MARKETING_FUNDS].releasePeriod = 30 days; // 1 month walletsLocking[MARKETING_FUNDS].releasePercentage = 1929144e17; // 192914.4 } function saleThreeAllocations() private { _allocate(0x2488f090656BddB63fe3Bdb506D0D109AaaD93Bb,58590); _allocate(0xD7a98d34CD49dd203cAc9752Ea400Ee309A5F602,46872 ); _allocate(0x7b88aD278Cd11506661516E544EcAA9e39F03aF0,39060 ); _allocate(0xc77c3EfB55bd7b0E44c13EB27eb33c98597f0a68,39060 ); _allocate(0x42D455B219214FDA88aF47786CC6e3B5f9a19c37,27342 ); _allocate(0x42D455B219214FDA88aF47786CC6e3B5f9a19c37,19530 ); _allocate(0x42D455B219214FDA88aF47786CC6e3B5f9a19c37,19530 ); _allocate(0xd4Bc360cFDd35e8025dA8237A49D80Fdfb8E351e,17577 ); _allocate(0x707D048708802Dc7730C722F8886105Ff07f0331,15624 ); _allocate(0xfcd987b0D6656c1c84EF73da18c6596D42a73c5E,15624 ); _allocate(0xa38B4f096Ef6323736D26BF6F9a9Ce1dd2257732,15624 ); _allocate(0x4b1bA9aA4337e65ffA2155b92BaFd8E177E73CB5,11718 ); _allocate(0xE8E61Db7918bD88E5ff764Ad5393e87D7AaEf9aD,11718 ); _allocate(0x28B7677b86be88d432775f1c808a33957f6833BE,11718 ); _allocate(0x65E27aD821D14E3567E97eb600728d2AAc7e1be4,11718 ); _allocate(0xDa892C1700147079d0bDeafB7b566E77315f98A4,11718 ); _allocate(0xb0B743639224d2c82c857E6a504daA207e385Dba,8203 ); _allocate(0xfce0413BAD4E59f55946669E678EccFe87777777,7812 ); _allocate(0x78782592D452e92fFFAB8e145201108e97cE36b6,7812 ); _allocate(0x78782592D452e92fFFAB8e145201108e97cE36b6,7812 ); _allocate(0x1e36795b5168E574b6EF0f0461CC4026251C533E,7812 ); _allocate(0x81aA6141923Ea42fCAa763d9857418224d9b025a,7812 ); _allocate(0xf470bbfeaB9B0d60e21FBd611C5d569df20704CE,7812 ); _allocate(0x31E985b4f7af6B479148d260309B7BcEcEF0fa7B,7812 ); _allocate(0x707D048708802Dc7730C722F8886105Ff07f0331,7812 ); _allocate(0xf2d2a2831f411F5cE863E8f836481dB0b40c03A5,7812 ); _allocate(0x716C9cC35607040f54b9232D35a2871F46894F58,6000 ); _allocate(0x81724bCe3D755AEB716d030cbD2c0f5b9f508Df0,5000 ); _allocate(0xE8CC2a8540C7339430859b8E7902AF2fE2d91865,4687 ); _allocate(0x268e1fEE56498Cc24758864AA092F870e8220f74,3906 ); _allocate(0xF93eD4Fe97eB8A2508D03222a28E332F1C89B0eD,3906 ); _allocate(0x65E27aD821D14E3567E97eb600728d2AAc7e1be4,3906 ); _allocate(0x001C88d92d199C9EB936Ed3D6758da7C48e4D08e,3906 ); _allocate(0x42c6Be1400578B238aCd8946FE9682E650DfdE8D,3906 ); _allocate(0x65E27aD821D14E3567E97eb600728d2AAc7e1be4,3906 ); _allocate(0xAcb272Eac895FA57394747615fCb068b8858AAF2,3906 ); _allocate(0x21eDE22Cb8Ab64F4F74128f3D0250a7851971A33,3906 ); _allocate(0x3DFf997410D94E2E3C961F805b85eB2Ef80622c5,3906 ); _allocate(0x8F70b3aC45A6896532FB90B992D5B7827bA88d3C,3906 ); _allocate(0xef6D6a51900B5cf220Fe54F8309B6Eda32e794E9,3906 ); _allocate(0x52BF55C77C402F90dF3Bc1d9E6a0faf262437ab1,3906 ); _allocate(0xa2639Ef1e7956b242E2C5Ac87b72B077FEbe2783,3906 ); _allocate(0x716C9cC35607040f54b9232D35a2871F46894F58,3906 ); _allocate(0x5826914A6223053038328ab3bc7CEB64db04DDc4,3515 ); _allocate(0x896Fa945c5533631F8DaFE7483FeA6859537cfD0,3125 ); _allocate(0x2d5304bA4f2c6EFF5D53CecF64AF89818A416cB9,3125 ); _allocate(0xD53354D4Fb7BcE81Cd4F83c457dbd5EF655C9E93,2734 ); _allocate(0x49216a6434B75051e9063E99Bb486bc85B0b0605,1953 ); _allocate(0xD53354D4Fb7BcE81Cd4F83c457dbd5EF655C9E93,1953 ); _allocate(0x4CEa5d86Bb0bBFa77CB452CCBD52e76dEA4dE045,1627 ); _allocate(0xC274362c1E85834Eb8387C18168C01aaEe2B00d7,1562 ); _allocate(0x18A8e216c3406dED40438856B45198B3ce39e522,1367 ); _allocate(0x51B3954e185869FB4cb9D2Bf9Fbd00A22900E800,477 ); } function saleOneAllocationsLocking() private { uint256 lockingPeriod = 24 hours; _allocateLock(0xCCa178a04D83Af193330C7927fb9a42212Fb1C25, 85932, lockingPeriod); _allocateLock(0xD7d7d68E4BDCf85c073485aB7Bfd151B0C019F1F, 39060, lockingPeriod); _allocateLock(0xf470bbfeaB9B0d60e21FBd611C5d569df20704CE, 31248, lockingPeriod); _allocateLock(0x9022BC8774AebC343De33423570b5285981bd9E1, 31248, lockingPeriod); _allocateLock(0xcf9Bb70b2f1aCCb846e8B0C665a1Ab5D5D35cA05, 31248, lockingPeriod); _allocateLock(0xfce0413BAD4E59f55946669E678EccFe87777777, 23436, lockingPeriod); _allocateLock(0xf470bbfeaB9B0d60e21FBd611C5d569df20704CE, 23436, lockingPeriod); _allocateLock(0xfEeA4Cd7a96dCffBDc6d2e6c814eb4544ab62667, 23436, lockingPeriod); _allocateLock(0xb4A0563DE6ABeE9C3C0631FbAE3444F012a40dB5, 19530, lockingPeriod); _allocateLock(0x54a9bB530474d287202Da7f4d5c9756E13f699f3, 15624, lockingPeriod); _allocateLock(0xEad249D58E4ebbFBf4ABbeCc1201bD88E50f7967, 15624, lockingPeriod); _allocateLock(0x3Dd4234DaeefBaBCeAA6068C04C3f75F19aa2cdA, 15624, lockingPeriod); _allocateLock(0x88F7541D87b7f3c88115A5b2387587263c5d4C7E, 11718, lockingPeriod); _allocateLock(0xf3e4D991a20043b6Bd025058CF4d96Fd7501070b, 11718, lockingPeriod); _allocateLock(0xEc315068A71458FB1A6cC063E9BC7369EC41a7a5, 8593, lockingPeriod); _allocateLock(0x54a9bB530474d287202Da7f4d5c9756E13f699f3, 7812, lockingPeriod); _allocateLock(0x0fEB352cfd10314af9abCF4eD03Da9311Bf8bC44, 7812, lockingPeriod); _allocateLock(0xd28932b8d4Be295D4B90b514EFa3E80436d66bEC, 7812, lockingPeriod); _allocateLock(0x268e1fEE56498Cc24758864AA092F870e8220f74, 7812, lockingPeriod); _allocateLock(0xDFF214084Fee648c8e0bc0838C1fa5E8548F58aC, 7812, lockingPeriod); _allocateLock(0x4356DdB30910c1f9b3Aa1e6A60111CE9802B6dF9, 7812, lockingPeriod); _allocateLock(0x863A3bD6f28f4F4A131c88708dA91076fDC362C7, 7812, lockingPeriod); _allocateLock(0x3F79B63823E435FaF08A95e0973b389333B19b99, 7812, lockingPeriod); _allocateLock(0x8F70b3aC45A6896532FB90B992D5B7827bA88d3C, 7812, lockingPeriod); _allocateLock(0xEc315068A71458FB1A6cC063E9BC7369EC41a7a5, 6640, lockingPeriod); _allocateLock(0x138EcD97Da1C9484263BfADDc1f3D6AE2a435bCb, 6250, lockingPeriod); _allocateLock(0x53A07d3c1Fdc58c0Cfd2c96817D9537A9E113dd4, 5468, lockingPeriod); _allocateLock(0xCEC0971e55A4C39e3e2C4d8f175CC6e53c138B0A, 4297, lockingPeriod); _allocateLock(0xBA682E593784f7654e4F92D58213dc495f229Eec, 3906, lockingPeriod); _allocateLock(0x9B9e35C223B39f908A036E41011D9E3aDb06ae0B, 3906, lockingPeriod); _allocateLock(0xBA98b69a140c078746219D0bBf0bb3b923483374, 3906, lockingPeriod); _allocateLock(0x34c4E14243a95b148534f894FCe86c61bC9F731a, 3906, lockingPeriod); _allocateLock(0x9A61567A3e3c5b47DFFB0670C629A40533Eb84d5, 3906, lockingPeriod); _allocateLock(0xda90dDbbdd4e0237C6889367c1556179c817680B, 3567, lockingPeriod); _allocateLock(0x329318Ca294A2d127e43058A7b23ED514B503d76, 2734, lockingPeriod); _allocateLock(0x7B3fC9597f146F0A80FC26dB0DdF62C04ea89740, 2578, lockingPeriod); _allocateLock(0xb6eC0d0172BC4Cff8fF669b543e03c2c8B64Fc5E, 2344, lockingPeriod); _allocateLock(0x53A07d3c1Fdc58c0Cfd2c96817D9537A9E113dd4, 2344, lockingPeriod); } function saleTwoAllocationsLocking() private { uint256 lockingPeriod = 12 hours; _allocateLock(0xc77c3EfB55bd7b0E44c13EB27eb33c98597f0a68, 16758, lockingPeriod); _allocateLock(0x9E817382A12D2b1D15246c4d383bEB8171BCdfA9, 13965, lockingPeriod); _allocateLock(0xfF6735CFf3DFED5d68dC3DbeBb0d34c5e815BA09, 11172, lockingPeriod); _allocateLock(0x5400087152e436C7C22883d01911868A3C892551, 7820, lockingPeriod); _allocateLock(0x974896E96219Dd508100f2Ad58921290655072aD, 5586, lockingPeriod); _allocateLock(0x0fEB352cfd10314af9abCF4eD03Da9311Bf8bC44, 5586, lockingPeriod); _allocateLock(0x268e1fEE56498Cc24758864AA092F870e8220f74, 5586, lockingPeriod); _allocateLock(0xC274362c1E85834Eb8387C18168C01aaEe2B00d7, 4469, lockingPeriod); _allocateLock(0x93935316db093A8665E91EE932591F76bf8E5295, 3631, lockingPeriod); _allocateLock(0x8bdBF4B19cb840e9Ac9B1eFFc2BfAd47591B5bF2, 2793, lockingPeriod); } function _allocateLock(address user, uint256 tokens, uint256 lockingPeriod) private{ uint256 startTime = 1599253200; // 4 sep walletsLocking[user].directRelease = true; walletsLocking[user].lockedTokens = tokens * 10 ** (decimals); walletsLocking[user].cliff = startTime.add(lockingPeriod); _allocate(user, tokens); } function _allocate(address user, uint256 tokens) private { balances[user] = balances[user].add(tokens * 10 ** (decimals)); emit Transfer(address(0),user, tokens * 10 ** (decimals)); } /** ERC20Interface function's implementation **/ function totalSupply() public override view returns (uint256){ return _totalSupply; } // ------------------------------------------------------------------------ // Get the token balance for account `tokenOwner` // ------------------------------------------------------------------------ function balanceOf(address tokenOwner) public override view returns (uint256 balance) { return balances[tokenOwner]; } // ------------------------------------------------------------------------ // Transfer the balance from token owner's account to `to` account // - Owner's account must have sufficient balance to transfer // - 0 value transfers are allowed // ------------------------------------------------------------------------ function transfer(address to, uint256 tokens) public override returns (bool success) { // prevent transfer to 0x0, use burn instead require(address(to) != address(0), "Transfer to address 0 not allowed"); require(balances[msg.sender] >= tokens, "SENDER: insufficient balance"); if (walletsLocking[msg.sender].lockedTokens > 0 ){ if(walletsLocking[msg.sender].directRelease) directRelease(msg.sender); else checkTime(msg.sender); } require(balances[msg.sender].sub(tokens) >= walletsLocking[msg.sender].lockedTokens, "Please wait for tokens to be released"); balances[msg.sender] = balances[msg.sender].sub(tokens); balances[to] = balances[to].add(tokens); emit Transfer(msg.sender, to, tokens); return true; } // ------------------------------------------------------------------------ // Token owner can approve for `spender` to transferFrom(...) `tokens` // from the token owner's account // ------------------------------------------------------------------------ function approve(address spender, uint256 tokens) public override returns (bool success){ allowed[msg.sender][spender] = tokens; emit Approval(msg.sender,spender,tokens); return true; } // ------------------------------------------------------------------------ // Transfer `tokens` from the `from` account to the `to` account // // The calling account must already have sufficient tokens approve(...)-d // for spending from the `from` account and // - From account must have sufficient balance to transfer // - Spender must have sufficient allowance to transfer // - 0 value transfers are allowed // ------------------------------------------------------------------------ function transferFrom(address from, address to, uint256 tokens) public override returns (bool success){ require(tokens <= allowed[from][msg.sender]); //check allowance // prevent transfer to 0x0, use burn instead require(address(to) != address(0), "Transfer to address 0 not allowed"); require(address(from) != address(0), "Transfer from address 0 not allowed"); require(balances[from] >= tokens, "SENDER: Insufficient balance"); if (walletsLocking[from].lockedTokens > 0){ if(walletsLocking[from].directRelease) directRelease(from); else checkTime(from); } require(balances[from].sub(tokens) >= walletsLocking[from].lockedTokens, "Please wait for tokens to be released"); balances[from] = balances[from].sub(tokens); balances[to] = balances[to].add(tokens); allowed[from][msg.sender] = allowed[from][msg.sender].sub(tokens); emit Transfer(from,to,tokens); return true; } // ------------------------------------------------------------------------ // Returns the amount of tokens approved by the owner that can be // transferred to the spender's account // ------------------------------------------------------------------------ function allowance(address tokenOwner, address spender) public override view returns (uint256 remaining) { return allowed[tokenOwner][spender]; } // ------------------------------------------------------------------------ // @dev Internal function that burns an amount of the token from a given account // @param _amount The amount that will be burnt // @param _account The tokens to burn from // can be used from account owner or contract owner // ------------------------------------------------------------------------ function burnTokens(uint256 _amount, address _account) public { require(msg.sender == _account || msg.sender == owner, "UnAuthorized"); require(balances[_account] >= _amount, "Insufficient account balance"); _totalSupply = _totalSupply.sub(_amount); balances[_account] = balances[_account].sub(_amount); emit Transfer(_account, address(0), _amount); } function directRelease(address _wallet) private{ if(block.timestamp > walletsLocking[_wallet].cliff){ walletsLocking[_wallet].lockedTokens = 0; } } function checkTime(address _wallet) private { // if cliff is applied if(block.timestamp > walletsLocking[_wallet].cliff){ uint256 timeSpanned = (now.sub(walletsLocking[_wallet].lastVisit)).div(walletsLocking[_wallet].releasePeriod); // if release period is passed if (timeSpanned >= 1){ uint256 released = timeSpanned.mul(walletsLocking[_wallet].releasePercentage); if (released > walletsLocking[_wallet].lockedTokens){ released = walletsLocking[_wallet].lockedTokens; } walletsLocking[_wallet].lastVisit = now; walletsLocking[_wallet].lockedTokens = walletsLocking[_wallet].lockedTokens.sub(released); } } } }
// ---------------------------------------------------------------------------- // ERC20 Token, with the addition of symbol, name and decimals and assisted // token transfers // ----------------------------------------------------------------------------
LineComment
transfer
function transfer(address to, uint256 tokens) public override returns (bool success) { // prevent transfer to 0x0, use burn instead require(address(to) != address(0), "Transfer to address 0 not allowed"); require(balances[msg.sender] >= tokens, "SENDER: insufficient balance"); if (walletsLocking[msg.sender].lockedTokens > 0 ){ if(walletsLocking[msg.sender].directRelease) directRelease(msg.sender); else checkTime(msg.sender); } require(balances[msg.sender].sub(tokens) >= walletsLocking[msg.sender].lockedTokens, "Please wait for tokens to be released"); balances[msg.sender] = balances[msg.sender].sub(tokens); balances[to] = balances[to].add(tokens); emit Transfer(msg.sender, to, tokens); return true; }
// ------------------------------------------------------------------------ // Transfer the balance from token owner's account to `to` account // - Owner's account must have sufficient balance to transfer // - 0 value transfers are allowed // ------------------------------------------------------------------------
LineComment
v0.6.6+commit.6c089d02
Unlicense
ipfs://10e7056ffdb36de8e87f8f571f3b72a1fb3c1fd831e1b8ae606289c735dea39d
{ "func_code_index": [ 16172, 17071 ] }
1,040
Token
Token.sol
0x8b80596660f007342dc590e5c53bbddd2cd550fb
Solidity
Token
contract Token is ERC20Interface, Owned { using SafeMath for uint256; string public symbol = "FRMS"; string public name = "The Forms"; uint256 public decimals = 18; uint256 private _totalSupply = 5898277 * 10 ** (decimals); mapping(address => uint256) balances; mapping(address => mapping(address => uint256)) allowed; address constant private TEAM = 0x24B73DC219196a5E373D73b7Cd638017f1f07E2F; address constant private MARKETING_FUNDS = 0x4B63B18b66Fc617B5A3125F0ABB565Dc22d732ba ; address constant private COMMUNITY_REWARD = 0xC071C603238F387E48Ee96826a81D608e304545A; address constant private PRIVATE_SALE_ADD1 = 0xB5Aceaa4db96d6901b492505170Ab7F1d6E7cdAd; address constant private PRIVATE_SALE_ADD2 = 0x8f63Fe51A3677cf02C80c11933De4B5846f2a336; address constant private PRIVATE_SALE_ADD3 = 0x134D97378Ed04eC0CaE4C689800Be9e96D683ac1; struct LOCKING{ uint256 lockedTokens; //DR , //PRC uint256 releasePeriod; uint256 cliff; //DR, PRC uint256 lastVisit; uint256 releasePercentage; bool directRelease; //DR } mapping(address => LOCKING) public walletsLocking; // ------------------------------------------------------------------------ // Constructor // ------------------------------------------------------------------------ constructor() public { owner = 0xA6a3E445E613FF022a3001091C7bE274B6a409B0; _tokenAllocation(); _setLocking(); saleOneAllocationsLocking(); saleTwoAllocationsLocking(); saleThreeAllocations(); } function _tokenAllocation() private { // send funds to team _allocate(TEAM, 1303625 ); // send funds to community reward _allocate(COMMUNITY_REWARD,1117393 ); // send funds to marketing funds _allocate(MARKETING_FUNDS, 964572); // send funds to owner for uniswap liquidity _allocate(owner, 354167 ); // Send to private sale addresses 1 _allocate(0xB5Aceaa4db96d6901b492505170Ab7F1d6E7cdAd, 529131); // Send to private sale addresses 2 _allocate(0x8f63Fe51A3677cf02C80c11933De4B5846f2a336, 242718 ); // Send to private sale addresses 3 _allocate(0x134D97378Ed04eC0CaE4C689800Be9e96D683ac1, 252427 ); } function _setLocking() private{ //////////////////////////////////TEAM//////////////////////////////////// walletsLocking[TEAM].directRelease = true; walletsLocking[TEAM].lockedTokens = 1303625 * 10 ** (decimals); walletsLocking[TEAM].cliff = block.timestamp.add(365 days); //////////////////////////////////PRIVATE SALE ADDRESS 1//////////////////////////////////// /////////////////////////////0xB5Aceaa4db96d6901b492505170Ab7F1d6E7cdAd//////////////////// walletsLocking[0xB5Aceaa4db96d6901b492505170Ab7F1d6E7cdAd].directRelease = true; walletsLocking[0xB5Aceaa4db96d6901b492505170Ab7F1d6E7cdAd].lockedTokens = 529131 * 10 ** (decimals); walletsLocking[0xB5Aceaa4db96d6901b492505170Ab7F1d6E7cdAd].cliff = block.timestamp.add(180 days); //////////////////////////////////PRIVATE SALE ADDRESS 2//////////////////////////////////// /////////////////////////////0x8f63Fe51A3677cf02C80c11933De4B5846f2a336//////////////////// walletsLocking[0x8f63Fe51A3677cf02C80c11933De4B5846f2a336].directRelease = true; walletsLocking[0x8f63Fe51A3677cf02C80c11933De4B5846f2a336].lockedTokens = 242718 * 10 ** (decimals); walletsLocking[0x8f63Fe51A3677cf02C80c11933De4B5846f2a336].cliff = block.timestamp.add(180 days); //////////////////////////////////PRIVATE SALE ADDRESS 3//////////////////////////////////// /////////////////////////////0x134D97378Ed04eC0CaE4C689800Be9e96D683ac1//////////////////// walletsLocking[0x134D97378Ed04eC0CaE4C689800Be9e96D683ac1].directRelease = true; walletsLocking[0x134D97378Ed04eC0CaE4C689800Be9e96D683ac1].lockedTokens = 252427 * 10 ** (decimals); walletsLocking[0x134D97378Ed04eC0CaE4C689800Be9e96D683ac1].cliff = block.timestamp.add(180 days); //////////////////////////////////COMMUNITY_REWARD//////////////////////////////////// walletsLocking[COMMUNITY_REWARD].directRelease = false; walletsLocking[COMMUNITY_REWARD].lockedTokens = 1117393 * 10 ** (decimals); walletsLocking[COMMUNITY_REWARD].cliff = block.timestamp.add(30 days); walletsLocking[COMMUNITY_REWARD].lastVisit = block.timestamp.add(30 days); walletsLocking[COMMUNITY_REWARD].releasePeriod = 30 days; // 1 month walletsLocking[COMMUNITY_REWARD].releasePercentage = 5586965e16; // 55869.65 //////////////////////////////////MARKETING_FUNDS//////////////////////////////////// walletsLocking[MARKETING_FUNDS].directRelease = false; walletsLocking[MARKETING_FUNDS].lockedTokens = 7716576e17; // 771657.6 walletsLocking[MARKETING_FUNDS].cliff = block.timestamp; walletsLocking[MARKETING_FUNDS].lastVisit = block.timestamp; walletsLocking[MARKETING_FUNDS].releasePeriod = 30 days; // 1 month walletsLocking[MARKETING_FUNDS].releasePercentage = 1929144e17; // 192914.4 } function saleThreeAllocations() private { _allocate(0x2488f090656BddB63fe3Bdb506D0D109AaaD93Bb,58590); _allocate(0xD7a98d34CD49dd203cAc9752Ea400Ee309A5F602,46872 ); _allocate(0x7b88aD278Cd11506661516E544EcAA9e39F03aF0,39060 ); _allocate(0xc77c3EfB55bd7b0E44c13EB27eb33c98597f0a68,39060 ); _allocate(0x42D455B219214FDA88aF47786CC6e3B5f9a19c37,27342 ); _allocate(0x42D455B219214FDA88aF47786CC6e3B5f9a19c37,19530 ); _allocate(0x42D455B219214FDA88aF47786CC6e3B5f9a19c37,19530 ); _allocate(0xd4Bc360cFDd35e8025dA8237A49D80Fdfb8E351e,17577 ); _allocate(0x707D048708802Dc7730C722F8886105Ff07f0331,15624 ); _allocate(0xfcd987b0D6656c1c84EF73da18c6596D42a73c5E,15624 ); _allocate(0xa38B4f096Ef6323736D26BF6F9a9Ce1dd2257732,15624 ); _allocate(0x4b1bA9aA4337e65ffA2155b92BaFd8E177E73CB5,11718 ); _allocate(0xE8E61Db7918bD88E5ff764Ad5393e87D7AaEf9aD,11718 ); _allocate(0x28B7677b86be88d432775f1c808a33957f6833BE,11718 ); _allocate(0x65E27aD821D14E3567E97eb600728d2AAc7e1be4,11718 ); _allocate(0xDa892C1700147079d0bDeafB7b566E77315f98A4,11718 ); _allocate(0xb0B743639224d2c82c857E6a504daA207e385Dba,8203 ); _allocate(0xfce0413BAD4E59f55946669E678EccFe87777777,7812 ); _allocate(0x78782592D452e92fFFAB8e145201108e97cE36b6,7812 ); _allocate(0x78782592D452e92fFFAB8e145201108e97cE36b6,7812 ); _allocate(0x1e36795b5168E574b6EF0f0461CC4026251C533E,7812 ); _allocate(0x81aA6141923Ea42fCAa763d9857418224d9b025a,7812 ); _allocate(0xf470bbfeaB9B0d60e21FBd611C5d569df20704CE,7812 ); _allocate(0x31E985b4f7af6B479148d260309B7BcEcEF0fa7B,7812 ); _allocate(0x707D048708802Dc7730C722F8886105Ff07f0331,7812 ); _allocate(0xf2d2a2831f411F5cE863E8f836481dB0b40c03A5,7812 ); _allocate(0x716C9cC35607040f54b9232D35a2871F46894F58,6000 ); _allocate(0x81724bCe3D755AEB716d030cbD2c0f5b9f508Df0,5000 ); _allocate(0xE8CC2a8540C7339430859b8E7902AF2fE2d91865,4687 ); _allocate(0x268e1fEE56498Cc24758864AA092F870e8220f74,3906 ); _allocate(0xF93eD4Fe97eB8A2508D03222a28E332F1C89B0eD,3906 ); _allocate(0x65E27aD821D14E3567E97eb600728d2AAc7e1be4,3906 ); _allocate(0x001C88d92d199C9EB936Ed3D6758da7C48e4D08e,3906 ); _allocate(0x42c6Be1400578B238aCd8946FE9682E650DfdE8D,3906 ); _allocate(0x65E27aD821D14E3567E97eb600728d2AAc7e1be4,3906 ); _allocate(0xAcb272Eac895FA57394747615fCb068b8858AAF2,3906 ); _allocate(0x21eDE22Cb8Ab64F4F74128f3D0250a7851971A33,3906 ); _allocate(0x3DFf997410D94E2E3C961F805b85eB2Ef80622c5,3906 ); _allocate(0x8F70b3aC45A6896532FB90B992D5B7827bA88d3C,3906 ); _allocate(0xef6D6a51900B5cf220Fe54F8309B6Eda32e794E9,3906 ); _allocate(0x52BF55C77C402F90dF3Bc1d9E6a0faf262437ab1,3906 ); _allocate(0xa2639Ef1e7956b242E2C5Ac87b72B077FEbe2783,3906 ); _allocate(0x716C9cC35607040f54b9232D35a2871F46894F58,3906 ); _allocate(0x5826914A6223053038328ab3bc7CEB64db04DDc4,3515 ); _allocate(0x896Fa945c5533631F8DaFE7483FeA6859537cfD0,3125 ); _allocate(0x2d5304bA4f2c6EFF5D53CecF64AF89818A416cB9,3125 ); _allocate(0xD53354D4Fb7BcE81Cd4F83c457dbd5EF655C9E93,2734 ); _allocate(0x49216a6434B75051e9063E99Bb486bc85B0b0605,1953 ); _allocate(0xD53354D4Fb7BcE81Cd4F83c457dbd5EF655C9E93,1953 ); _allocate(0x4CEa5d86Bb0bBFa77CB452CCBD52e76dEA4dE045,1627 ); _allocate(0xC274362c1E85834Eb8387C18168C01aaEe2B00d7,1562 ); _allocate(0x18A8e216c3406dED40438856B45198B3ce39e522,1367 ); _allocate(0x51B3954e185869FB4cb9D2Bf9Fbd00A22900E800,477 ); } function saleOneAllocationsLocking() private { uint256 lockingPeriod = 24 hours; _allocateLock(0xCCa178a04D83Af193330C7927fb9a42212Fb1C25, 85932, lockingPeriod); _allocateLock(0xD7d7d68E4BDCf85c073485aB7Bfd151B0C019F1F, 39060, lockingPeriod); _allocateLock(0xf470bbfeaB9B0d60e21FBd611C5d569df20704CE, 31248, lockingPeriod); _allocateLock(0x9022BC8774AebC343De33423570b5285981bd9E1, 31248, lockingPeriod); _allocateLock(0xcf9Bb70b2f1aCCb846e8B0C665a1Ab5D5D35cA05, 31248, lockingPeriod); _allocateLock(0xfce0413BAD4E59f55946669E678EccFe87777777, 23436, lockingPeriod); _allocateLock(0xf470bbfeaB9B0d60e21FBd611C5d569df20704CE, 23436, lockingPeriod); _allocateLock(0xfEeA4Cd7a96dCffBDc6d2e6c814eb4544ab62667, 23436, lockingPeriod); _allocateLock(0xb4A0563DE6ABeE9C3C0631FbAE3444F012a40dB5, 19530, lockingPeriod); _allocateLock(0x54a9bB530474d287202Da7f4d5c9756E13f699f3, 15624, lockingPeriod); _allocateLock(0xEad249D58E4ebbFBf4ABbeCc1201bD88E50f7967, 15624, lockingPeriod); _allocateLock(0x3Dd4234DaeefBaBCeAA6068C04C3f75F19aa2cdA, 15624, lockingPeriod); _allocateLock(0x88F7541D87b7f3c88115A5b2387587263c5d4C7E, 11718, lockingPeriod); _allocateLock(0xf3e4D991a20043b6Bd025058CF4d96Fd7501070b, 11718, lockingPeriod); _allocateLock(0xEc315068A71458FB1A6cC063E9BC7369EC41a7a5, 8593, lockingPeriod); _allocateLock(0x54a9bB530474d287202Da7f4d5c9756E13f699f3, 7812, lockingPeriod); _allocateLock(0x0fEB352cfd10314af9abCF4eD03Da9311Bf8bC44, 7812, lockingPeriod); _allocateLock(0xd28932b8d4Be295D4B90b514EFa3E80436d66bEC, 7812, lockingPeriod); _allocateLock(0x268e1fEE56498Cc24758864AA092F870e8220f74, 7812, lockingPeriod); _allocateLock(0xDFF214084Fee648c8e0bc0838C1fa5E8548F58aC, 7812, lockingPeriod); _allocateLock(0x4356DdB30910c1f9b3Aa1e6A60111CE9802B6dF9, 7812, lockingPeriod); _allocateLock(0x863A3bD6f28f4F4A131c88708dA91076fDC362C7, 7812, lockingPeriod); _allocateLock(0x3F79B63823E435FaF08A95e0973b389333B19b99, 7812, lockingPeriod); _allocateLock(0x8F70b3aC45A6896532FB90B992D5B7827bA88d3C, 7812, lockingPeriod); _allocateLock(0xEc315068A71458FB1A6cC063E9BC7369EC41a7a5, 6640, lockingPeriod); _allocateLock(0x138EcD97Da1C9484263BfADDc1f3D6AE2a435bCb, 6250, lockingPeriod); _allocateLock(0x53A07d3c1Fdc58c0Cfd2c96817D9537A9E113dd4, 5468, lockingPeriod); _allocateLock(0xCEC0971e55A4C39e3e2C4d8f175CC6e53c138B0A, 4297, lockingPeriod); _allocateLock(0xBA682E593784f7654e4F92D58213dc495f229Eec, 3906, lockingPeriod); _allocateLock(0x9B9e35C223B39f908A036E41011D9E3aDb06ae0B, 3906, lockingPeriod); _allocateLock(0xBA98b69a140c078746219D0bBf0bb3b923483374, 3906, lockingPeriod); _allocateLock(0x34c4E14243a95b148534f894FCe86c61bC9F731a, 3906, lockingPeriod); _allocateLock(0x9A61567A3e3c5b47DFFB0670C629A40533Eb84d5, 3906, lockingPeriod); _allocateLock(0xda90dDbbdd4e0237C6889367c1556179c817680B, 3567, lockingPeriod); _allocateLock(0x329318Ca294A2d127e43058A7b23ED514B503d76, 2734, lockingPeriod); _allocateLock(0x7B3fC9597f146F0A80FC26dB0DdF62C04ea89740, 2578, lockingPeriod); _allocateLock(0xb6eC0d0172BC4Cff8fF669b543e03c2c8B64Fc5E, 2344, lockingPeriod); _allocateLock(0x53A07d3c1Fdc58c0Cfd2c96817D9537A9E113dd4, 2344, lockingPeriod); } function saleTwoAllocationsLocking() private { uint256 lockingPeriod = 12 hours; _allocateLock(0xc77c3EfB55bd7b0E44c13EB27eb33c98597f0a68, 16758, lockingPeriod); _allocateLock(0x9E817382A12D2b1D15246c4d383bEB8171BCdfA9, 13965, lockingPeriod); _allocateLock(0xfF6735CFf3DFED5d68dC3DbeBb0d34c5e815BA09, 11172, lockingPeriod); _allocateLock(0x5400087152e436C7C22883d01911868A3C892551, 7820, lockingPeriod); _allocateLock(0x974896E96219Dd508100f2Ad58921290655072aD, 5586, lockingPeriod); _allocateLock(0x0fEB352cfd10314af9abCF4eD03Da9311Bf8bC44, 5586, lockingPeriod); _allocateLock(0x268e1fEE56498Cc24758864AA092F870e8220f74, 5586, lockingPeriod); _allocateLock(0xC274362c1E85834Eb8387C18168C01aaEe2B00d7, 4469, lockingPeriod); _allocateLock(0x93935316db093A8665E91EE932591F76bf8E5295, 3631, lockingPeriod); _allocateLock(0x8bdBF4B19cb840e9Ac9B1eFFc2BfAd47591B5bF2, 2793, lockingPeriod); } function _allocateLock(address user, uint256 tokens, uint256 lockingPeriod) private{ uint256 startTime = 1599253200; // 4 sep walletsLocking[user].directRelease = true; walletsLocking[user].lockedTokens = tokens * 10 ** (decimals); walletsLocking[user].cliff = startTime.add(lockingPeriod); _allocate(user, tokens); } function _allocate(address user, uint256 tokens) private { balances[user] = balances[user].add(tokens * 10 ** (decimals)); emit Transfer(address(0),user, tokens * 10 ** (decimals)); } /** ERC20Interface function's implementation **/ function totalSupply() public override view returns (uint256){ return _totalSupply; } // ------------------------------------------------------------------------ // Get the token balance for account `tokenOwner` // ------------------------------------------------------------------------ function balanceOf(address tokenOwner) public override view returns (uint256 balance) { return balances[tokenOwner]; } // ------------------------------------------------------------------------ // Transfer the balance from token owner's account to `to` account // - Owner's account must have sufficient balance to transfer // - 0 value transfers are allowed // ------------------------------------------------------------------------ function transfer(address to, uint256 tokens) public override returns (bool success) { // prevent transfer to 0x0, use burn instead require(address(to) != address(0), "Transfer to address 0 not allowed"); require(balances[msg.sender] >= tokens, "SENDER: insufficient balance"); if (walletsLocking[msg.sender].lockedTokens > 0 ){ if(walletsLocking[msg.sender].directRelease) directRelease(msg.sender); else checkTime(msg.sender); } require(balances[msg.sender].sub(tokens) >= walletsLocking[msg.sender].lockedTokens, "Please wait for tokens to be released"); balances[msg.sender] = balances[msg.sender].sub(tokens); balances[to] = balances[to].add(tokens); emit Transfer(msg.sender, to, tokens); return true; } // ------------------------------------------------------------------------ // Token owner can approve for `spender` to transferFrom(...) `tokens` // from the token owner's account // ------------------------------------------------------------------------ function approve(address spender, uint256 tokens) public override returns (bool success){ allowed[msg.sender][spender] = tokens; emit Approval(msg.sender,spender,tokens); return true; } // ------------------------------------------------------------------------ // Transfer `tokens` from the `from` account to the `to` account // // The calling account must already have sufficient tokens approve(...)-d // for spending from the `from` account and // - From account must have sufficient balance to transfer // - Spender must have sufficient allowance to transfer // - 0 value transfers are allowed // ------------------------------------------------------------------------ function transferFrom(address from, address to, uint256 tokens) public override returns (bool success){ require(tokens <= allowed[from][msg.sender]); //check allowance // prevent transfer to 0x0, use burn instead require(address(to) != address(0), "Transfer to address 0 not allowed"); require(address(from) != address(0), "Transfer from address 0 not allowed"); require(balances[from] >= tokens, "SENDER: Insufficient balance"); if (walletsLocking[from].lockedTokens > 0){ if(walletsLocking[from].directRelease) directRelease(from); else checkTime(from); } require(balances[from].sub(tokens) >= walletsLocking[from].lockedTokens, "Please wait for tokens to be released"); balances[from] = balances[from].sub(tokens); balances[to] = balances[to].add(tokens); allowed[from][msg.sender] = allowed[from][msg.sender].sub(tokens); emit Transfer(from,to,tokens); return true; } // ------------------------------------------------------------------------ // Returns the amount of tokens approved by the owner that can be // transferred to the spender's account // ------------------------------------------------------------------------ function allowance(address tokenOwner, address spender) public override view returns (uint256 remaining) { return allowed[tokenOwner][spender]; } // ------------------------------------------------------------------------ // @dev Internal function that burns an amount of the token from a given account // @param _amount The amount that will be burnt // @param _account The tokens to burn from // can be used from account owner or contract owner // ------------------------------------------------------------------------ function burnTokens(uint256 _amount, address _account) public { require(msg.sender == _account || msg.sender == owner, "UnAuthorized"); require(balances[_account] >= _amount, "Insufficient account balance"); _totalSupply = _totalSupply.sub(_amount); balances[_account] = balances[_account].sub(_amount); emit Transfer(_account, address(0), _amount); } function directRelease(address _wallet) private{ if(block.timestamp > walletsLocking[_wallet].cliff){ walletsLocking[_wallet].lockedTokens = 0; } } function checkTime(address _wallet) private { // if cliff is applied if(block.timestamp > walletsLocking[_wallet].cliff){ uint256 timeSpanned = (now.sub(walletsLocking[_wallet].lastVisit)).div(walletsLocking[_wallet].releasePeriod); // if release period is passed if (timeSpanned >= 1){ uint256 released = timeSpanned.mul(walletsLocking[_wallet].releasePercentage); if (released > walletsLocking[_wallet].lockedTokens){ released = walletsLocking[_wallet].lockedTokens; } walletsLocking[_wallet].lastVisit = now; walletsLocking[_wallet].lockedTokens = walletsLocking[_wallet].lockedTokens.sub(released); } } } }
// ---------------------------------------------------------------------------- // ERC20 Token, with the addition of symbol, name and decimals and assisted // token transfers // ----------------------------------------------------------------------------
LineComment
approve
function approve(address spender, uint256 tokens) public override returns (bool success){ allowed[msg.sender][spender] = tokens; emit Approval(msg.sender,spender,tokens); return true; }
// ------------------------------------------------------------------------ // Token owner can approve for `spender` to transferFrom(...) `tokens` // from the token owner's account // ------------------------------------------------------------------------
LineComment
v0.6.6+commit.6c089d02
Unlicense
ipfs://10e7056ffdb36de8e87f8f571f3b72a1fb3c1fd831e1b8ae606289c735dea39d
{ "func_code_index": [ 17351, 17573 ] }
1,041
Token
Token.sol
0x8b80596660f007342dc590e5c53bbddd2cd550fb
Solidity
Token
contract Token is ERC20Interface, Owned { using SafeMath for uint256; string public symbol = "FRMS"; string public name = "The Forms"; uint256 public decimals = 18; uint256 private _totalSupply = 5898277 * 10 ** (decimals); mapping(address => uint256) balances; mapping(address => mapping(address => uint256)) allowed; address constant private TEAM = 0x24B73DC219196a5E373D73b7Cd638017f1f07E2F; address constant private MARKETING_FUNDS = 0x4B63B18b66Fc617B5A3125F0ABB565Dc22d732ba ; address constant private COMMUNITY_REWARD = 0xC071C603238F387E48Ee96826a81D608e304545A; address constant private PRIVATE_SALE_ADD1 = 0xB5Aceaa4db96d6901b492505170Ab7F1d6E7cdAd; address constant private PRIVATE_SALE_ADD2 = 0x8f63Fe51A3677cf02C80c11933De4B5846f2a336; address constant private PRIVATE_SALE_ADD3 = 0x134D97378Ed04eC0CaE4C689800Be9e96D683ac1; struct LOCKING{ uint256 lockedTokens; //DR , //PRC uint256 releasePeriod; uint256 cliff; //DR, PRC uint256 lastVisit; uint256 releasePercentage; bool directRelease; //DR } mapping(address => LOCKING) public walletsLocking; // ------------------------------------------------------------------------ // Constructor // ------------------------------------------------------------------------ constructor() public { owner = 0xA6a3E445E613FF022a3001091C7bE274B6a409B0; _tokenAllocation(); _setLocking(); saleOneAllocationsLocking(); saleTwoAllocationsLocking(); saleThreeAllocations(); } function _tokenAllocation() private { // send funds to team _allocate(TEAM, 1303625 ); // send funds to community reward _allocate(COMMUNITY_REWARD,1117393 ); // send funds to marketing funds _allocate(MARKETING_FUNDS, 964572); // send funds to owner for uniswap liquidity _allocate(owner, 354167 ); // Send to private sale addresses 1 _allocate(0xB5Aceaa4db96d6901b492505170Ab7F1d6E7cdAd, 529131); // Send to private sale addresses 2 _allocate(0x8f63Fe51A3677cf02C80c11933De4B5846f2a336, 242718 ); // Send to private sale addresses 3 _allocate(0x134D97378Ed04eC0CaE4C689800Be9e96D683ac1, 252427 ); } function _setLocking() private{ //////////////////////////////////TEAM//////////////////////////////////// walletsLocking[TEAM].directRelease = true; walletsLocking[TEAM].lockedTokens = 1303625 * 10 ** (decimals); walletsLocking[TEAM].cliff = block.timestamp.add(365 days); //////////////////////////////////PRIVATE SALE ADDRESS 1//////////////////////////////////// /////////////////////////////0xB5Aceaa4db96d6901b492505170Ab7F1d6E7cdAd//////////////////// walletsLocking[0xB5Aceaa4db96d6901b492505170Ab7F1d6E7cdAd].directRelease = true; walletsLocking[0xB5Aceaa4db96d6901b492505170Ab7F1d6E7cdAd].lockedTokens = 529131 * 10 ** (decimals); walletsLocking[0xB5Aceaa4db96d6901b492505170Ab7F1d6E7cdAd].cliff = block.timestamp.add(180 days); //////////////////////////////////PRIVATE SALE ADDRESS 2//////////////////////////////////// /////////////////////////////0x8f63Fe51A3677cf02C80c11933De4B5846f2a336//////////////////// walletsLocking[0x8f63Fe51A3677cf02C80c11933De4B5846f2a336].directRelease = true; walletsLocking[0x8f63Fe51A3677cf02C80c11933De4B5846f2a336].lockedTokens = 242718 * 10 ** (decimals); walletsLocking[0x8f63Fe51A3677cf02C80c11933De4B5846f2a336].cliff = block.timestamp.add(180 days); //////////////////////////////////PRIVATE SALE ADDRESS 3//////////////////////////////////// /////////////////////////////0x134D97378Ed04eC0CaE4C689800Be9e96D683ac1//////////////////// walletsLocking[0x134D97378Ed04eC0CaE4C689800Be9e96D683ac1].directRelease = true; walletsLocking[0x134D97378Ed04eC0CaE4C689800Be9e96D683ac1].lockedTokens = 252427 * 10 ** (decimals); walletsLocking[0x134D97378Ed04eC0CaE4C689800Be9e96D683ac1].cliff = block.timestamp.add(180 days); //////////////////////////////////COMMUNITY_REWARD//////////////////////////////////// walletsLocking[COMMUNITY_REWARD].directRelease = false; walletsLocking[COMMUNITY_REWARD].lockedTokens = 1117393 * 10 ** (decimals); walletsLocking[COMMUNITY_REWARD].cliff = block.timestamp.add(30 days); walletsLocking[COMMUNITY_REWARD].lastVisit = block.timestamp.add(30 days); walletsLocking[COMMUNITY_REWARD].releasePeriod = 30 days; // 1 month walletsLocking[COMMUNITY_REWARD].releasePercentage = 5586965e16; // 55869.65 //////////////////////////////////MARKETING_FUNDS//////////////////////////////////// walletsLocking[MARKETING_FUNDS].directRelease = false; walletsLocking[MARKETING_FUNDS].lockedTokens = 7716576e17; // 771657.6 walletsLocking[MARKETING_FUNDS].cliff = block.timestamp; walletsLocking[MARKETING_FUNDS].lastVisit = block.timestamp; walletsLocking[MARKETING_FUNDS].releasePeriod = 30 days; // 1 month walletsLocking[MARKETING_FUNDS].releasePercentage = 1929144e17; // 192914.4 } function saleThreeAllocations() private { _allocate(0x2488f090656BddB63fe3Bdb506D0D109AaaD93Bb,58590); _allocate(0xD7a98d34CD49dd203cAc9752Ea400Ee309A5F602,46872 ); _allocate(0x7b88aD278Cd11506661516E544EcAA9e39F03aF0,39060 ); _allocate(0xc77c3EfB55bd7b0E44c13EB27eb33c98597f0a68,39060 ); _allocate(0x42D455B219214FDA88aF47786CC6e3B5f9a19c37,27342 ); _allocate(0x42D455B219214FDA88aF47786CC6e3B5f9a19c37,19530 ); _allocate(0x42D455B219214FDA88aF47786CC6e3B5f9a19c37,19530 ); _allocate(0xd4Bc360cFDd35e8025dA8237A49D80Fdfb8E351e,17577 ); _allocate(0x707D048708802Dc7730C722F8886105Ff07f0331,15624 ); _allocate(0xfcd987b0D6656c1c84EF73da18c6596D42a73c5E,15624 ); _allocate(0xa38B4f096Ef6323736D26BF6F9a9Ce1dd2257732,15624 ); _allocate(0x4b1bA9aA4337e65ffA2155b92BaFd8E177E73CB5,11718 ); _allocate(0xE8E61Db7918bD88E5ff764Ad5393e87D7AaEf9aD,11718 ); _allocate(0x28B7677b86be88d432775f1c808a33957f6833BE,11718 ); _allocate(0x65E27aD821D14E3567E97eb600728d2AAc7e1be4,11718 ); _allocate(0xDa892C1700147079d0bDeafB7b566E77315f98A4,11718 ); _allocate(0xb0B743639224d2c82c857E6a504daA207e385Dba,8203 ); _allocate(0xfce0413BAD4E59f55946669E678EccFe87777777,7812 ); _allocate(0x78782592D452e92fFFAB8e145201108e97cE36b6,7812 ); _allocate(0x78782592D452e92fFFAB8e145201108e97cE36b6,7812 ); _allocate(0x1e36795b5168E574b6EF0f0461CC4026251C533E,7812 ); _allocate(0x81aA6141923Ea42fCAa763d9857418224d9b025a,7812 ); _allocate(0xf470bbfeaB9B0d60e21FBd611C5d569df20704CE,7812 ); _allocate(0x31E985b4f7af6B479148d260309B7BcEcEF0fa7B,7812 ); _allocate(0x707D048708802Dc7730C722F8886105Ff07f0331,7812 ); _allocate(0xf2d2a2831f411F5cE863E8f836481dB0b40c03A5,7812 ); _allocate(0x716C9cC35607040f54b9232D35a2871F46894F58,6000 ); _allocate(0x81724bCe3D755AEB716d030cbD2c0f5b9f508Df0,5000 ); _allocate(0xE8CC2a8540C7339430859b8E7902AF2fE2d91865,4687 ); _allocate(0x268e1fEE56498Cc24758864AA092F870e8220f74,3906 ); _allocate(0xF93eD4Fe97eB8A2508D03222a28E332F1C89B0eD,3906 ); _allocate(0x65E27aD821D14E3567E97eb600728d2AAc7e1be4,3906 ); _allocate(0x001C88d92d199C9EB936Ed3D6758da7C48e4D08e,3906 ); _allocate(0x42c6Be1400578B238aCd8946FE9682E650DfdE8D,3906 ); _allocate(0x65E27aD821D14E3567E97eb600728d2AAc7e1be4,3906 ); _allocate(0xAcb272Eac895FA57394747615fCb068b8858AAF2,3906 ); _allocate(0x21eDE22Cb8Ab64F4F74128f3D0250a7851971A33,3906 ); _allocate(0x3DFf997410D94E2E3C961F805b85eB2Ef80622c5,3906 ); _allocate(0x8F70b3aC45A6896532FB90B992D5B7827bA88d3C,3906 ); _allocate(0xef6D6a51900B5cf220Fe54F8309B6Eda32e794E9,3906 ); _allocate(0x52BF55C77C402F90dF3Bc1d9E6a0faf262437ab1,3906 ); _allocate(0xa2639Ef1e7956b242E2C5Ac87b72B077FEbe2783,3906 ); _allocate(0x716C9cC35607040f54b9232D35a2871F46894F58,3906 ); _allocate(0x5826914A6223053038328ab3bc7CEB64db04DDc4,3515 ); _allocate(0x896Fa945c5533631F8DaFE7483FeA6859537cfD0,3125 ); _allocate(0x2d5304bA4f2c6EFF5D53CecF64AF89818A416cB9,3125 ); _allocate(0xD53354D4Fb7BcE81Cd4F83c457dbd5EF655C9E93,2734 ); _allocate(0x49216a6434B75051e9063E99Bb486bc85B0b0605,1953 ); _allocate(0xD53354D4Fb7BcE81Cd4F83c457dbd5EF655C9E93,1953 ); _allocate(0x4CEa5d86Bb0bBFa77CB452CCBD52e76dEA4dE045,1627 ); _allocate(0xC274362c1E85834Eb8387C18168C01aaEe2B00d7,1562 ); _allocate(0x18A8e216c3406dED40438856B45198B3ce39e522,1367 ); _allocate(0x51B3954e185869FB4cb9D2Bf9Fbd00A22900E800,477 ); } function saleOneAllocationsLocking() private { uint256 lockingPeriod = 24 hours; _allocateLock(0xCCa178a04D83Af193330C7927fb9a42212Fb1C25, 85932, lockingPeriod); _allocateLock(0xD7d7d68E4BDCf85c073485aB7Bfd151B0C019F1F, 39060, lockingPeriod); _allocateLock(0xf470bbfeaB9B0d60e21FBd611C5d569df20704CE, 31248, lockingPeriod); _allocateLock(0x9022BC8774AebC343De33423570b5285981bd9E1, 31248, lockingPeriod); _allocateLock(0xcf9Bb70b2f1aCCb846e8B0C665a1Ab5D5D35cA05, 31248, lockingPeriod); _allocateLock(0xfce0413BAD4E59f55946669E678EccFe87777777, 23436, lockingPeriod); _allocateLock(0xf470bbfeaB9B0d60e21FBd611C5d569df20704CE, 23436, lockingPeriod); _allocateLock(0xfEeA4Cd7a96dCffBDc6d2e6c814eb4544ab62667, 23436, lockingPeriod); _allocateLock(0xb4A0563DE6ABeE9C3C0631FbAE3444F012a40dB5, 19530, lockingPeriod); _allocateLock(0x54a9bB530474d287202Da7f4d5c9756E13f699f3, 15624, lockingPeriod); _allocateLock(0xEad249D58E4ebbFBf4ABbeCc1201bD88E50f7967, 15624, lockingPeriod); _allocateLock(0x3Dd4234DaeefBaBCeAA6068C04C3f75F19aa2cdA, 15624, lockingPeriod); _allocateLock(0x88F7541D87b7f3c88115A5b2387587263c5d4C7E, 11718, lockingPeriod); _allocateLock(0xf3e4D991a20043b6Bd025058CF4d96Fd7501070b, 11718, lockingPeriod); _allocateLock(0xEc315068A71458FB1A6cC063E9BC7369EC41a7a5, 8593, lockingPeriod); _allocateLock(0x54a9bB530474d287202Da7f4d5c9756E13f699f3, 7812, lockingPeriod); _allocateLock(0x0fEB352cfd10314af9abCF4eD03Da9311Bf8bC44, 7812, lockingPeriod); _allocateLock(0xd28932b8d4Be295D4B90b514EFa3E80436d66bEC, 7812, lockingPeriod); _allocateLock(0x268e1fEE56498Cc24758864AA092F870e8220f74, 7812, lockingPeriod); _allocateLock(0xDFF214084Fee648c8e0bc0838C1fa5E8548F58aC, 7812, lockingPeriod); _allocateLock(0x4356DdB30910c1f9b3Aa1e6A60111CE9802B6dF9, 7812, lockingPeriod); _allocateLock(0x863A3bD6f28f4F4A131c88708dA91076fDC362C7, 7812, lockingPeriod); _allocateLock(0x3F79B63823E435FaF08A95e0973b389333B19b99, 7812, lockingPeriod); _allocateLock(0x8F70b3aC45A6896532FB90B992D5B7827bA88d3C, 7812, lockingPeriod); _allocateLock(0xEc315068A71458FB1A6cC063E9BC7369EC41a7a5, 6640, lockingPeriod); _allocateLock(0x138EcD97Da1C9484263BfADDc1f3D6AE2a435bCb, 6250, lockingPeriod); _allocateLock(0x53A07d3c1Fdc58c0Cfd2c96817D9537A9E113dd4, 5468, lockingPeriod); _allocateLock(0xCEC0971e55A4C39e3e2C4d8f175CC6e53c138B0A, 4297, lockingPeriod); _allocateLock(0xBA682E593784f7654e4F92D58213dc495f229Eec, 3906, lockingPeriod); _allocateLock(0x9B9e35C223B39f908A036E41011D9E3aDb06ae0B, 3906, lockingPeriod); _allocateLock(0xBA98b69a140c078746219D0bBf0bb3b923483374, 3906, lockingPeriod); _allocateLock(0x34c4E14243a95b148534f894FCe86c61bC9F731a, 3906, lockingPeriod); _allocateLock(0x9A61567A3e3c5b47DFFB0670C629A40533Eb84d5, 3906, lockingPeriod); _allocateLock(0xda90dDbbdd4e0237C6889367c1556179c817680B, 3567, lockingPeriod); _allocateLock(0x329318Ca294A2d127e43058A7b23ED514B503d76, 2734, lockingPeriod); _allocateLock(0x7B3fC9597f146F0A80FC26dB0DdF62C04ea89740, 2578, lockingPeriod); _allocateLock(0xb6eC0d0172BC4Cff8fF669b543e03c2c8B64Fc5E, 2344, lockingPeriod); _allocateLock(0x53A07d3c1Fdc58c0Cfd2c96817D9537A9E113dd4, 2344, lockingPeriod); } function saleTwoAllocationsLocking() private { uint256 lockingPeriod = 12 hours; _allocateLock(0xc77c3EfB55bd7b0E44c13EB27eb33c98597f0a68, 16758, lockingPeriod); _allocateLock(0x9E817382A12D2b1D15246c4d383bEB8171BCdfA9, 13965, lockingPeriod); _allocateLock(0xfF6735CFf3DFED5d68dC3DbeBb0d34c5e815BA09, 11172, lockingPeriod); _allocateLock(0x5400087152e436C7C22883d01911868A3C892551, 7820, lockingPeriod); _allocateLock(0x974896E96219Dd508100f2Ad58921290655072aD, 5586, lockingPeriod); _allocateLock(0x0fEB352cfd10314af9abCF4eD03Da9311Bf8bC44, 5586, lockingPeriod); _allocateLock(0x268e1fEE56498Cc24758864AA092F870e8220f74, 5586, lockingPeriod); _allocateLock(0xC274362c1E85834Eb8387C18168C01aaEe2B00d7, 4469, lockingPeriod); _allocateLock(0x93935316db093A8665E91EE932591F76bf8E5295, 3631, lockingPeriod); _allocateLock(0x8bdBF4B19cb840e9Ac9B1eFFc2BfAd47591B5bF2, 2793, lockingPeriod); } function _allocateLock(address user, uint256 tokens, uint256 lockingPeriod) private{ uint256 startTime = 1599253200; // 4 sep walletsLocking[user].directRelease = true; walletsLocking[user].lockedTokens = tokens * 10 ** (decimals); walletsLocking[user].cliff = startTime.add(lockingPeriod); _allocate(user, tokens); } function _allocate(address user, uint256 tokens) private { balances[user] = balances[user].add(tokens * 10 ** (decimals)); emit Transfer(address(0),user, tokens * 10 ** (decimals)); } /** ERC20Interface function's implementation **/ function totalSupply() public override view returns (uint256){ return _totalSupply; } // ------------------------------------------------------------------------ // Get the token balance for account `tokenOwner` // ------------------------------------------------------------------------ function balanceOf(address tokenOwner) public override view returns (uint256 balance) { return balances[tokenOwner]; } // ------------------------------------------------------------------------ // Transfer the balance from token owner's account to `to` account // - Owner's account must have sufficient balance to transfer // - 0 value transfers are allowed // ------------------------------------------------------------------------ function transfer(address to, uint256 tokens) public override returns (bool success) { // prevent transfer to 0x0, use burn instead require(address(to) != address(0), "Transfer to address 0 not allowed"); require(balances[msg.sender] >= tokens, "SENDER: insufficient balance"); if (walletsLocking[msg.sender].lockedTokens > 0 ){ if(walletsLocking[msg.sender].directRelease) directRelease(msg.sender); else checkTime(msg.sender); } require(balances[msg.sender].sub(tokens) >= walletsLocking[msg.sender].lockedTokens, "Please wait for tokens to be released"); balances[msg.sender] = balances[msg.sender].sub(tokens); balances[to] = balances[to].add(tokens); emit Transfer(msg.sender, to, tokens); return true; } // ------------------------------------------------------------------------ // Token owner can approve for `spender` to transferFrom(...) `tokens` // from the token owner's account // ------------------------------------------------------------------------ function approve(address spender, uint256 tokens) public override returns (bool success){ allowed[msg.sender][spender] = tokens; emit Approval(msg.sender,spender,tokens); return true; } // ------------------------------------------------------------------------ // Transfer `tokens` from the `from` account to the `to` account // // The calling account must already have sufficient tokens approve(...)-d // for spending from the `from` account and // - From account must have sufficient balance to transfer // - Spender must have sufficient allowance to transfer // - 0 value transfers are allowed // ------------------------------------------------------------------------ function transferFrom(address from, address to, uint256 tokens) public override returns (bool success){ require(tokens <= allowed[from][msg.sender]); //check allowance // prevent transfer to 0x0, use burn instead require(address(to) != address(0), "Transfer to address 0 not allowed"); require(address(from) != address(0), "Transfer from address 0 not allowed"); require(balances[from] >= tokens, "SENDER: Insufficient balance"); if (walletsLocking[from].lockedTokens > 0){ if(walletsLocking[from].directRelease) directRelease(from); else checkTime(from); } require(balances[from].sub(tokens) >= walletsLocking[from].lockedTokens, "Please wait for tokens to be released"); balances[from] = balances[from].sub(tokens); balances[to] = balances[to].add(tokens); allowed[from][msg.sender] = allowed[from][msg.sender].sub(tokens); emit Transfer(from,to,tokens); return true; } // ------------------------------------------------------------------------ // Returns the amount of tokens approved by the owner that can be // transferred to the spender's account // ------------------------------------------------------------------------ function allowance(address tokenOwner, address spender) public override view returns (uint256 remaining) { return allowed[tokenOwner][spender]; } // ------------------------------------------------------------------------ // @dev Internal function that burns an amount of the token from a given account // @param _amount The amount that will be burnt // @param _account The tokens to burn from // can be used from account owner or contract owner // ------------------------------------------------------------------------ function burnTokens(uint256 _amount, address _account) public { require(msg.sender == _account || msg.sender == owner, "UnAuthorized"); require(balances[_account] >= _amount, "Insufficient account balance"); _totalSupply = _totalSupply.sub(_amount); balances[_account] = balances[_account].sub(_amount); emit Transfer(_account, address(0), _amount); } function directRelease(address _wallet) private{ if(block.timestamp > walletsLocking[_wallet].cliff){ walletsLocking[_wallet].lockedTokens = 0; } } function checkTime(address _wallet) private { // if cliff is applied if(block.timestamp > walletsLocking[_wallet].cliff){ uint256 timeSpanned = (now.sub(walletsLocking[_wallet].lastVisit)).div(walletsLocking[_wallet].releasePeriod); // if release period is passed if (timeSpanned >= 1){ uint256 released = timeSpanned.mul(walletsLocking[_wallet].releasePercentage); if (released > walletsLocking[_wallet].lockedTokens){ released = walletsLocking[_wallet].lockedTokens; } walletsLocking[_wallet].lastVisit = now; walletsLocking[_wallet].lockedTokens = walletsLocking[_wallet].lockedTokens.sub(released); } } } }
// ---------------------------------------------------------------------------- // ERC20 Token, with the addition of symbol, name and decimals and assisted // token transfers // ----------------------------------------------------------------------------
LineComment
transferFrom
function transferFrom(address from, address to, uint256 tokens) public override returns (bool success){ require(tokens <= allowed[from][msg.sender]); //check allowance // prevent transfer to 0x0, use burn instead require(address(to) != address(0), "Transfer to address 0 not allowed"); require(address(from) != address(0), "Transfer from address 0 not allowed"); require(balances[from] >= tokens, "SENDER: Insufficient balance"); if (walletsLocking[from].lockedTokens > 0){ if(walletsLocking[from].directRelease) directRelease(from); else checkTime(from); } require(balances[from].sub(tokens) >= walletsLocking[from].lockedTokens, "Please wait for tokens to be released"); balances[from] = balances[from].sub(tokens); balances[to] = balances[to].add(tokens); allowed[from][msg.sender] = allowed[from][msg.sender].sub(tokens); emit Transfer(from,to,tokens); return true; }
// ------------------------------------------------------------------------ // Transfer `tokens` from the `from` account to the `to` account // // The calling account must already have sufficient tokens approve(...)-d // for spending from the `from` account and // - From account must have sufficient balance to transfer // - Spender must have sufficient allowance to transfer // - 0 value transfers are allowed // ------------------------------------------------------------------------
LineComment
v0.6.6+commit.6c089d02
Unlicense
ipfs://10e7056ffdb36de8e87f8f571f3b72a1fb3c1fd831e1b8ae606289c735dea39d
{ "func_code_index": [ 18109, 19207 ] }
1,042
Token
Token.sol
0x8b80596660f007342dc590e5c53bbddd2cd550fb
Solidity
Token
contract Token is ERC20Interface, Owned { using SafeMath for uint256; string public symbol = "FRMS"; string public name = "The Forms"; uint256 public decimals = 18; uint256 private _totalSupply = 5898277 * 10 ** (decimals); mapping(address => uint256) balances; mapping(address => mapping(address => uint256)) allowed; address constant private TEAM = 0x24B73DC219196a5E373D73b7Cd638017f1f07E2F; address constant private MARKETING_FUNDS = 0x4B63B18b66Fc617B5A3125F0ABB565Dc22d732ba ; address constant private COMMUNITY_REWARD = 0xC071C603238F387E48Ee96826a81D608e304545A; address constant private PRIVATE_SALE_ADD1 = 0xB5Aceaa4db96d6901b492505170Ab7F1d6E7cdAd; address constant private PRIVATE_SALE_ADD2 = 0x8f63Fe51A3677cf02C80c11933De4B5846f2a336; address constant private PRIVATE_SALE_ADD3 = 0x134D97378Ed04eC0CaE4C689800Be9e96D683ac1; struct LOCKING{ uint256 lockedTokens; //DR , //PRC uint256 releasePeriod; uint256 cliff; //DR, PRC uint256 lastVisit; uint256 releasePercentage; bool directRelease; //DR } mapping(address => LOCKING) public walletsLocking; // ------------------------------------------------------------------------ // Constructor // ------------------------------------------------------------------------ constructor() public { owner = 0xA6a3E445E613FF022a3001091C7bE274B6a409B0; _tokenAllocation(); _setLocking(); saleOneAllocationsLocking(); saleTwoAllocationsLocking(); saleThreeAllocations(); } function _tokenAllocation() private { // send funds to team _allocate(TEAM, 1303625 ); // send funds to community reward _allocate(COMMUNITY_REWARD,1117393 ); // send funds to marketing funds _allocate(MARKETING_FUNDS, 964572); // send funds to owner for uniswap liquidity _allocate(owner, 354167 ); // Send to private sale addresses 1 _allocate(0xB5Aceaa4db96d6901b492505170Ab7F1d6E7cdAd, 529131); // Send to private sale addresses 2 _allocate(0x8f63Fe51A3677cf02C80c11933De4B5846f2a336, 242718 ); // Send to private sale addresses 3 _allocate(0x134D97378Ed04eC0CaE4C689800Be9e96D683ac1, 252427 ); } function _setLocking() private{ //////////////////////////////////TEAM//////////////////////////////////// walletsLocking[TEAM].directRelease = true; walletsLocking[TEAM].lockedTokens = 1303625 * 10 ** (decimals); walletsLocking[TEAM].cliff = block.timestamp.add(365 days); //////////////////////////////////PRIVATE SALE ADDRESS 1//////////////////////////////////// /////////////////////////////0xB5Aceaa4db96d6901b492505170Ab7F1d6E7cdAd//////////////////// walletsLocking[0xB5Aceaa4db96d6901b492505170Ab7F1d6E7cdAd].directRelease = true; walletsLocking[0xB5Aceaa4db96d6901b492505170Ab7F1d6E7cdAd].lockedTokens = 529131 * 10 ** (decimals); walletsLocking[0xB5Aceaa4db96d6901b492505170Ab7F1d6E7cdAd].cliff = block.timestamp.add(180 days); //////////////////////////////////PRIVATE SALE ADDRESS 2//////////////////////////////////// /////////////////////////////0x8f63Fe51A3677cf02C80c11933De4B5846f2a336//////////////////// walletsLocking[0x8f63Fe51A3677cf02C80c11933De4B5846f2a336].directRelease = true; walletsLocking[0x8f63Fe51A3677cf02C80c11933De4B5846f2a336].lockedTokens = 242718 * 10 ** (decimals); walletsLocking[0x8f63Fe51A3677cf02C80c11933De4B5846f2a336].cliff = block.timestamp.add(180 days); //////////////////////////////////PRIVATE SALE ADDRESS 3//////////////////////////////////// /////////////////////////////0x134D97378Ed04eC0CaE4C689800Be9e96D683ac1//////////////////// walletsLocking[0x134D97378Ed04eC0CaE4C689800Be9e96D683ac1].directRelease = true; walletsLocking[0x134D97378Ed04eC0CaE4C689800Be9e96D683ac1].lockedTokens = 252427 * 10 ** (decimals); walletsLocking[0x134D97378Ed04eC0CaE4C689800Be9e96D683ac1].cliff = block.timestamp.add(180 days); //////////////////////////////////COMMUNITY_REWARD//////////////////////////////////// walletsLocking[COMMUNITY_REWARD].directRelease = false; walletsLocking[COMMUNITY_REWARD].lockedTokens = 1117393 * 10 ** (decimals); walletsLocking[COMMUNITY_REWARD].cliff = block.timestamp.add(30 days); walletsLocking[COMMUNITY_REWARD].lastVisit = block.timestamp.add(30 days); walletsLocking[COMMUNITY_REWARD].releasePeriod = 30 days; // 1 month walletsLocking[COMMUNITY_REWARD].releasePercentage = 5586965e16; // 55869.65 //////////////////////////////////MARKETING_FUNDS//////////////////////////////////// walletsLocking[MARKETING_FUNDS].directRelease = false; walletsLocking[MARKETING_FUNDS].lockedTokens = 7716576e17; // 771657.6 walletsLocking[MARKETING_FUNDS].cliff = block.timestamp; walletsLocking[MARKETING_FUNDS].lastVisit = block.timestamp; walletsLocking[MARKETING_FUNDS].releasePeriod = 30 days; // 1 month walletsLocking[MARKETING_FUNDS].releasePercentage = 1929144e17; // 192914.4 } function saleThreeAllocations() private { _allocate(0x2488f090656BddB63fe3Bdb506D0D109AaaD93Bb,58590); _allocate(0xD7a98d34CD49dd203cAc9752Ea400Ee309A5F602,46872 ); _allocate(0x7b88aD278Cd11506661516E544EcAA9e39F03aF0,39060 ); _allocate(0xc77c3EfB55bd7b0E44c13EB27eb33c98597f0a68,39060 ); _allocate(0x42D455B219214FDA88aF47786CC6e3B5f9a19c37,27342 ); _allocate(0x42D455B219214FDA88aF47786CC6e3B5f9a19c37,19530 ); _allocate(0x42D455B219214FDA88aF47786CC6e3B5f9a19c37,19530 ); _allocate(0xd4Bc360cFDd35e8025dA8237A49D80Fdfb8E351e,17577 ); _allocate(0x707D048708802Dc7730C722F8886105Ff07f0331,15624 ); _allocate(0xfcd987b0D6656c1c84EF73da18c6596D42a73c5E,15624 ); _allocate(0xa38B4f096Ef6323736D26BF6F9a9Ce1dd2257732,15624 ); _allocate(0x4b1bA9aA4337e65ffA2155b92BaFd8E177E73CB5,11718 ); _allocate(0xE8E61Db7918bD88E5ff764Ad5393e87D7AaEf9aD,11718 ); _allocate(0x28B7677b86be88d432775f1c808a33957f6833BE,11718 ); _allocate(0x65E27aD821D14E3567E97eb600728d2AAc7e1be4,11718 ); _allocate(0xDa892C1700147079d0bDeafB7b566E77315f98A4,11718 ); _allocate(0xb0B743639224d2c82c857E6a504daA207e385Dba,8203 ); _allocate(0xfce0413BAD4E59f55946669E678EccFe87777777,7812 ); _allocate(0x78782592D452e92fFFAB8e145201108e97cE36b6,7812 ); _allocate(0x78782592D452e92fFFAB8e145201108e97cE36b6,7812 ); _allocate(0x1e36795b5168E574b6EF0f0461CC4026251C533E,7812 ); _allocate(0x81aA6141923Ea42fCAa763d9857418224d9b025a,7812 ); _allocate(0xf470bbfeaB9B0d60e21FBd611C5d569df20704CE,7812 ); _allocate(0x31E985b4f7af6B479148d260309B7BcEcEF0fa7B,7812 ); _allocate(0x707D048708802Dc7730C722F8886105Ff07f0331,7812 ); _allocate(0xf2d2a2831f411F5cE863E8f836481dB0b40c03A5,7812 ); _allocate(0x716C9cC35607040f54b9232D35a2871F46894F58,6000 ); _allocate(0x81724bCe3D755AEB716d030cbD2c0f5b9f508Df0,5000 ); _allocate(0xE8CC2a8540C7339430859b8E7902AF2fE2d91865,4687 ); _allocate(0x268e1fEE56498Cc24758864AA092F870e8220f74,3906 ); _allocate(0xF93eD4Fe97eB8A2508D03222a28E332F1C89B0eD,3906 ); _allocate(0x65E27aD821D14E3567E97eb600728d2AAc7e1be4,3906 ); _allocate(0x001C88d92d199C9EB936Ed3D6758da7C48e4D08e,3906 ); _allocate(0x42c6Be1400578B238aCd8946FE9682E650DfdE8D,3906 ); _allocate(0x65E27aD821D14E3567E97eb600728d2AAc7e1be4,3906 ); _allocate(0xAcb272Eac895FA57394747615fCb068b8858AAF2,3906 ); _allocate(0x21eDE22Cb8Ab64F4F74128f3D0250a7851971A33,3906 ); _allocate(0x3DFf997410D94E2E3C961F805b85eB2Ef80622c5,3906 ); _allocate(0x8F70b3aC45A6896532FB90B992D5B7827bA88d3C,3906 ); _allocate(0xef6D6a51900B5cf220Fe54F8309B6Eda32e794E9,3906 ); _allocate(0x52BF55C77C402F90dF3Bc1d9E6a0faf262437ab1,3906 ); _allocate(0xa2639Ef1e7956b242E2C5Ac87b72B077FEbe2783,3906 ); _allocate(0x716C9cC35607040f54b9232D35a2871F46894F58,3906 ); _allocate(0x5826914A6223053038328ab3bc7CEB64db04DDc4,3515 ); _allocate(0x896Fa945c5533631F8DaFE7483FeA6859537cfD0,3125 ); _allocate(0x2d5304bA4f2c6EFF5D53CecF64AF89818A416cB9,3125 ); _allocate(0xD53354D4Fb7BcE81Cd4F83c457dbd5EF655C9E93,2734 ); _allocate(0x49216a6434B75051e9063E99Bb486bc85B0b0605,1953 ); _allocate(0xD53354D4Fb7BcE81Cd4F83c457dbd5EF655C9E93,1953 ); _allocate(0x4CEa5d86Bb0bBFa77CB452CCBD52e76dEA4dE045,1627 ); _allocate(0xC274362c1E85834Eb8387C18168C01aaEe2B00d7,1562 ); _allocate(0x18A8e216c3406dED40438856B45198B3ce39e522,1367 ); _allocate(0x51B3954e185869FB4cb9D2Bf9Fbd00A22900E800,477 ); } function saleOneAllocationsLocking() private { uint256 lockingPeriod = 24 hours; _allocateLock(0xCCa178a04D83Af193330C7927fb9a42212Fb1C25, 85932, lockingPeriod); _allocateLock(0xD7d7d68E4BDCf85c073485aB7Bfd151B0C019F1F, 39060, lockingPeriod); _allocateLock(0xf470bbfeaB9B0d60e21FBd611C5d569df20704CE, 31248, lockingPeriod); _allocateLock(0x9022BC8774AebC343De33423570b5285981bd9E1, 31248, lockingPeriod); _allocateLock(0xcf9Bb70b2f1aCCb846e8B0C665a1Ab5D5D35cA05, 31248, lockingPeriod); _allocateLock(0xfce0413BAD4E59f55946669E678EccFe87777777, 23436, lockingPeriod); _allocateLock(0xf470bbfeaB9B0d60e21FBd611C5d569df20704CE, 23436, lockingPeriod); _allocateLock(0xfEeA4Cd7a96dCffBDc6d2e6c814eb4544ab62667, 23436, lockingPeriod); _allocateLock(0xb4A0563DE6ABeE9C3C0631FbAE3444F012a40dB5, 19530, lockingPeriod); _allocateLock(0x54a9bB530474d287202Da7f4d5c9756E13f699f3, 15624, lockingPeriod); _allocateLock(0xEad249D58E4ebbFBf4ABbeCc1201bD88E50f7967, 15624, lockingPeriod); _allocateLock(0x3Dd4234DaeefBaBCeAA6068C04C3f75F19aa2cdA, 15624, lockingPeriod); _allocateLock(0x88F7541D87b7f3c88115A5b2387587263c5d4C7E, 11718, lockingPeriod); _allocateLock(0xf3e4D991a20043b6Bd025058CF4d96Fd7501070b, 11718, lockingPeriod); _allocateLock(0xEc315068A71458FB1A6cC063E9BC7369EC41a7a5, 8593, lockingPeriod); _allocateLock(0x54a9bB530474d287202Da7f4d5c9756E13f699f3, 7812, lockingPeriod); _allocateLock(0x0fEB352cfd10314af9abCF4eD03Da9311Bf8bC44, 7812, lockingPeriod); _allocateLock(0xd28932b8d4Be295D4B90b514EFa3E80436d66bEC, 7812, lockingPeriod); _allocateLock(0x268e1fEE56498Cc24758864AA092F870e8220f74, 7812, lockingPeriod); _allocateLock(0xDFF214084Fee648c8e0bc0838C1fa5E8548F58aC, 7812, lockingPeriod); _allocateLock(0x4356DdB30910c1f9b3Aa1e6A60111CE9802B6dF9, 7812, lockingPeriod); _allocateLock(0x863A3bD6f28f4F4A131c88708dA91076fDC362C7, 7812, lockingPeriod); _allocateLock(0x3F79B63823E435FaF08A95e0973b389333B19b99, 7812, lockingPeriod); _allocateLock(0x8F70b3aC45A6896532FB90B992D5B7827bA88d3C, 7812, lockingPeriod); _allocateLock(0xEc315068A71458FB1A6cC063E9BC7369EC41a7a5, 6640, lockingPeriod); _allocateLock(0x138EcD97Da1C9484263BfADDc1f3D6AE2a435bCb, 6250, lockingPeriod); _allocateLock(0x53A07d3c1Fdc58c0Cfd2c96817D9537A9E113dd4, 5468, lockingPeriod); _allocateLock(0xCEC0971e55A4C39e3e2C4d8f175CC6e53c138B0A, 4297, lockingPeriod); _allocateLock(0xBA682E593784f7654e4F92D58213dc495f229Eec, 3906, lockingPeriod); _allocateLock(0x9B9e35C223B39f908A036E41011D9E3aDb06ae0B, 3906, lockingPeriod); _allocateLock(0xBA98b69a140c078746219D0bBf0bb3b923483374, 3906, lockingPeriod); _allocateLock(0x34c4E14243a95b148534f894FCe86c61bC9F731a, 3906, lockingPeriod); _allocateLock(0x9A61567A3e3c5b47DFFB0670C629A40533Eb84d5, 3906, lockingPeriod); _allocateLock(0xda90dDbbdd4e0237C6889367c1556179c817680B, 3567, lockingPeriod); _allocateLock(0x329318Ca294A2d127e43058A7b23ED514B503d76, 2734, lockingPeriod); _allocateLock(0x7B3fC9597f146F0A80FC26dB0DdF62C04ea89740, 2578, lockingPeriod); _allocateLock(0xb6eC0d0172BC4Cff8fF669b543e03c2c8B64Fc5E, 2344, lockingPeriod); _allocateLock(0x53A07d3c1Fdc58c0Cfd2c96817D9537A9E113dd4, 2344, lockingPeriod); } function saleTwoAllocationsLocking() private { uint256 lockingPeriod = 12 hours; _allocateLock(0xc77c3EfB55bd7b0E44c13EB27eb33c98597f0a68, 16758, lockingPeriod); _allocateLock(0x9E817382A12D2b1D15246c4d383bEB8171BCdfA9, 13965, lockingPeriod); _allocateLock(0xfF6735CFf3DFED5d68dC3DbeBb0d34c5e815BA09, 11172, lockingPeriod); _allocateLock(0x5400087152e436C7C22883d01911868A3C892551, 7820, lockingPeriod); _allocateLock(0x974896E96219Dd508100f2Ad58921290655072aD, 5586, lockingPeriod); _allocateLock(0x0fEB352cfd10314af9abCF4eD03Da9311Bf8bC44, 5586, lockingPeriod); _allocateLock(0x268e1fEE56498Cc24758864AA092F870e8220f74, 5586, lockingPeriod); _allocateLock(0xC274362c1E85834Eb8387C18168C01aaEe2B00d7, 4469, lockingPeriod); _allocateLock(0x93935316db093A8665E91EE932591F76bf8E5295, 3631, lockingPeriod); _allocateLock(0x8bdBF4B19cb840e9Ac9B1eFFc2BfAd47591B5bF2, 2793, lockingPeriod); } function _allocateLock(address user, uint256 tokens, uint256 lockingPeriod) private{ uint256 startTime = 1599253200; // 4 sep walletsLocking[user].directRelease = true; walletsLocking[user].lockedTokens = tokens * 10 ** (decimals); walletsLocking[user].cliff = startTime.add(lockingPeriod); _allocate(user, tokens); } function _allocate(address user, uint256 tokens) private { balances[user] = balances[user].add(tokens * 10 ** (decimals)); emit Transfer(address(0),user, tokens * 10 ** (decimals)); } /** ERC20Interface function's implementation **/ function totalSupply() public override view returns (uint256){ return _totalSupply; } // ------------------------------------------------------------------------ // Get the token balance for account `tokenOwner` // ------------------------------------------------------------------------ function balanceOf(address tokenOwner) public override view returns (uint256 balance) { return balances[tokenOwner]; } // ------------------------------------------------------------------------ // Transfer the balance from token owner's account to `to` account // - Owner's account must have sufficient balance to transfer // - 0 value transfers are allowed // ------------------------------------------------------------------------ function transfer(address to, uint256 tokens) public override returns (bool success) { // prevent transfer to 0x0, use burn instead require(address(to) != address(0), "Transfer to address 0 not allowed"); require(balances[msg.sender] >= tokens, "SENDER: insufficient balance"); if (walletsLocking[msg.sender].lockedTokens > 0 ){ if(walletsLocking[msg.sender].directRelease) directRelease(msg.sender); else checkTime(msg.sender); } require(balances[msg.sender].sub(tokens) >= walletsLocking[msg.sender].lockedTokens, "Please wait for tokens to be released"); balances[msg.sender] = balances[msg.sender].sub(tokens); balances[to] = balances[to].add(tokens); emit Transfer(msg.sender, to, tokens); return true; } // ------------------------------------------------------------------------ // Token owner can approve for `spender` to transferFrom(...) `tokens` // from the token owner's account // ------------------------------------------------------------------------ function approve(address spender, uint256 tokens) public override returns (bool success){ allowed[msg.sender][spender] = tokens; emit Approval(msg.sender,spender,tokens); return true; } // ------------------------------------------------------------------------ // Transfer `tokens` from the `from` account to the `to` account // // The calling account must already have sufficient tokens approve(...)-d // for spending from the `from` account and // - From account must have sufficient balance to transfer // - Spender must have sufficient allowance to transfer // - 0 value transfers are allowed // ------------------------------------------------------------------------ function transferFrom(address from, address to, uint256 tokens) public override returns (bool success){ require(tokens <= allowed[from][msg.sender]); //check allowance // prevent transfer to 0x0, use burn instead require(address(to) != address(0), "Transfer to address 0 not allowed"); require(address(from) != address(0), "Transfer from address 0 not allowed"); require(balances[from] >= tokens, "SENDER: Insufficient balance"); if (walletsLocking[from].lockedTokens > 0){ if(walletsLocking[from].directRelease) directRelease(from); else checkTime(from); } require(balances[from].sub(tokens) >= walletsLocking[from].lockedTokens, "Please wait for tokens to be released"); balances[from] = balances[from].sub(tokens); balances[to] = balances[to].add(tokens); allowed[from][msg.sender] = allowed[from][msg.sender].sub(tokens); emit Transfer(from,to,tokens); return true; } // ------------------------------------------------------------------------ // Returns the amount of tokens approved by the owner that can be // transferred to the spender's account // ------------------------------------------------------------------------ function allowance(address tokenOwner, address spender) public override view returns (uint256 remaining) { return allowed[tokenOwner][spender]; } // ------------------------------------------------------------------------ // @dev Internal function that burns an amount of the token from a given account // @param _amount The amount that will be burnt // @param _account The tokens to burn from // can be used from account owner or contract owner // ------------------------------------------------------------------------ function burnTokens(uint256 _amount, address _account) public { require(msg.sender == _account || msg.sender == owner, "UnAuthorized"); require(balances[_account] >= _amount, "Insufficient account balance"); _totalSupply = _totalSupply.sub(_amount); balances[_account] = balances[_account].sub(_amount); emit Transfer(_account, address(0), _amount); } function directRelease(address _wallet) private{ if(block.timestamp > walletsLocking[_wallet].cliff){ walletsLocking[_wallet].lockedTokens = 0; } } function checkTime(address _wallet) private { // if cliff is applied if(block.timestamp > walletsLocking[_wallet].cliff){ uint256 timeSpanned = (now.sub(walletsLocking[_wallet].lastVisit)).div(walletsLocking[_wallet].releasePeriod); // if release period is passed if (timeSpanned >= 1){ uint256 released = timeSpanned.mul(walletsLocking[_wallet].releasePercentage); if (released > walletsLocking[_wallet].lockedTokens){ released = walletsLocking[_wallet].lockedTokens; } walletsLocking[_wallet].lastVisit = now; walletsLocking[_wallet].lockedTokens = walletsLocking[_wallet].lockedTokens.sub(released); } } } }
// ---------------------------------------------------------------------------- // ERC20 Token, with the addition of symbol, name and decimals and assisted // token transfers // ----------------------------------------------------------------------------
LineComment
allowance
function allowance(address tokenOwner, address spender) public override view returns (uint256 remaining) { return allowed[tokenOwner][spender]; }
// ------------------------------------------------------------------------ // Returns the amount of tokens approved by the owner that can be // transferred to the spender's account // ------------------------------------------------------------------------
LineComment
v0.6.6+commit.6c089d02
Unlicense
ipfs://10e7056ffdb36de8e87f8f571f3b72a1fb3c1fd831e1b8ae606289c735dea39d
{ "func_code_index": [ 19488, 19652 ] }
1,043
Token
Token.sol
0x8b80596660f007342dc590e5c53bbddd2cd550fb
Solidity
Token
contract Token is ERC20Interface, Owned { using SafeMath for uint256; string public symbol = "FRMS"; string public name = "The Forms"; uint256 public decimals = 18; uint256 private _totalSupply = 5898277 * 10 ** (decimals); mapping(address => uint256) balances; mapping(address => mapping(address => uint256)) allowed; address constant private TEAM = 0x24B73DC219196a5E373D73b7Cd638017f1f07E2F; address constant private MARKETING_FUNDS = 0x4B63B18b66Fc617B5A3125F0ABB565Dc22d732ba ; address constant private COMMUNITY_REWARD = 0xC071C603238F387E48Ee96826a81D608e304545A; address constant private PRIVATE_SALE_ADD1 = 0xB5Aceaa4db96d6901b492505170Ab7F1d6E7cdAd; address constant private PRIVATE_SALE_ADD2 = 0x8f63Fe51A3677cf02C80c11933De4B5846f2a336; address constant private PRIVATE_SALE_ADD3 = 0x134D97378Ed04eC0CaE4C689800Be9e96D683ac1; struct LOCKING{ uint256 lockedTokens; //DR , //PRC uint256 releasePeriod; uint256 cliff; //DR, PRC uint256 lastVisit; uint256 releasePercentage; bool directRelease; //DR } mapping(address => LOCKING) public walletsLocking; // ------------------------------------------------------------------------ // Constructor // ------------------------------------------------------------------------ constructor() public { owner = 0xA6a3E445E613FF022a3001091C7bE274B6a409B0; _tokenAllocation(); _setLocking(); saleOneAllocationsLocking(); saleTwoAllocationsLocking(); saleThreeAllocations(); } function _tokenAllocation() private { // send funds to team _allocate(TEAM, 1303625 ); // send funds to community reward _allocate(COMMUNITY_REWARD,1117393 ); // send funds to marketing funds _allocate(MARKETING_FUNDS, 964572); // send funds to owner for uniswap liquidity _allocate(owner, 354167 ); // Send to private sale addresses 1 _allocate(0xB5Aceaa4db96d6901b492505170Ab7F1d6E7cdAd, 529131); // Send to private sale addresses 2 _allocate(0x8f63Fe51A3677cf02C80c11933De4B5846f2a336, 242718 ); // Send to private sale addresses 3 _allocate(0x134D97378Ed04eC0CaE4C689800Be9e96D683ac1, 252427 ); } function _setLocking() private{ //////////////////////////////////TEAM//////////////////////////////////// walletsLocking[TEAM].directRelease = true; walletsLocking[TEAM].lockedTokens = 1303625 * 10 ** (decimals); walletsLocking[TEAM].cliff = block.timestamp.add(365 days); //////////////////////////////////PRIVATE SALE ADDRESS 1//////////////////////////////////// /////////////////////////////0xB5Aceaa4db96d6901b492505170Ab7F1d6E7cdAd//////////////////// walletsLocking[0xB5Aceaa4db96d6901b492505170Ab7F1d6E7cdAd].directRelease = true; walletsLocking[0xB5Aceaa4db96d6901b492505170Ab7F1d6E7cdAd].lockedTokens = 529131 * 10 ** (decimals); walletsLocking[0xB5Aceaa4db96d6901b492505170Ab7F1d6E7cdAd].cliff = block.timestamp.add(180 days); //////////////////////////////////PRIVATE SALE ADDRESS 2//////////////////////////////////// /////////////////////////////0x8f63Fe51A3677cf02C80c11933De4B5846f2a336//////////////////// walletsLocking[0x8f63Fe51A3677cf02C80c11933De4B5846f2a336].directRelease = true; walletsLocking[0x8f63Fe51A3677cf02C80c11933De4B5846f2a336].lockedTokens = 242718 * 10 ** (decimals); walletsLocking[0x8f63Fe51A3677cf02C80c11933De4B5846f2a336].cliff = block.timestamp.add(180 days); //////////////////////////////////PRIVATE SALE ADDRESS 3//////////////////////////////////// /////////////////////////////0x134D97378Ed04eC0CaE4C689800Be9e96D683ac1//////////////////// walletsLocking[0x134D97378Ed04eC0CaE4C689800Be9e96D683ac1].directRelease = true; walletsLocking[0x134D97378Ed04eC0CaE4C689800Be9e96D683ac1].lockedTokens = 252427 * 10 ** (decimals); walletsLocking[0x134D97378Ed04eC0CaE4C689800Be9e96D683ac1].cliff = block.timestamp.add(180 days); //////////////////////////////////COMMUNITY_REWARD//////////////////////////////////// walletsLocking[COMMUNITY_REWARD].directRelease = false; walletsLocking[COMMUNITY_REWARD].lockedTokens = 1117393 * 10 ** (decimals); walletsLocking[COMMUNITY_REWARD].cliff = block.timestamp.add(30 days); walletsLocking[COMMUNITY_REWARD].lastVisit = block.timestamp.add(30 days); walletsLocking[COMMUNITY_REWARD].releasePeriod = 30 days; // 1 month walletsLocking[COMMUNITY_REWARD].releasePercentage = 5586965e16; // 55869.65 //////////////////////////////////MARKETING_FUNDS//////////////////////////////////// walletsLocking[MARKETING_FUNDS].directRelease = false; walletsLocking[MARKETING_FUNDS].lockedTokens = 7716576e17; // 771657.6 walletsLocking[MARKETING_FUNDS].cliff = block.timestamp; walletsLocking[MARKETING_FUNDS].lastVisit = block.timestamp; walletsLocking[MARKETING_FUNDS].releasePeriod = 30 days; // 1 month walletsLocking[MARKETING_FUNDS].releasePercentage = 1929144e17; // 192914.4 } function saleThreeAllocations() private { _allocate(0x2488f090656BddB63fe3Bdb506D0D109AaaD93Bb,58590); _allocate(0xD7a98d34CD49dd203cAc9752Ea400Ee309A5F602,46872 ); _allocate(0x7b88aD278Cd11506661516E544EcAA9e39F03aF0,39060 ); _allocate(0xc77c3EfB55bd7b0E44c13EB27eb33c98597f0a68,39060 ); _allocate(0x42D455B219214FDA88aF47786CC6e3B5f9a19c37,27342 ); _allocate(0x42D455B219214FDA88aF47786CC6e3B5f9a19c37,19530 ); _allocate(0x42D455B219214FDA88aF47786CC6e3B5f9a19c37,19530 ); _allocate(0xd4Bc360cFDd35e8025dA8237A49D80Fdfb8E351e,17577 ); _allocate(0x707D048708802Dc7730C722F8886105Ff07f0331,15624 ); _allocate(0xfcd987b0D6656c1c84EF73da18c6596D42a73c5E,15624 ); _allocate(0xa38B4f096Ef6323736D26BF6F9a9Ce1dd2257732,15624 ); _allocate(0x4b1bA9aA4337e65ffA2155b92BaFd8E177E73CB5,11718 ); _allocate(0xE8E61Db7918bD88E5ff764Ad5393e87D7AaEf9aD,11718 ); _allocate(0x28B7677b86be88d432775f1c808a33957f6833BE,11718 ); _allocate(0x65E27aD821D14E3567E97eb600728d2AAc7e1be4,11718 ); _allocate(0xDa892C1700147079d0bDeafB7b566E77315f98A4,11718 ); _allocate(0xb0B743639224d2c82c857E6a504daA207e385Dba,8203 ); _allocate(0xfce0413BAD4E59f55946669E678EccFe87777777,7812 ); _allocate(0x78782592D452e92fFFAB8e145201108e97cE36b6,7812 ); _allocate(0x78782592D452e92fFFAB8e145201108e97cE36b6,7812 ); _allocate(0x1e36795b5168E574b6EF0f0461CC4026251C533E,7812 ); _allocate(0x81aA6141923Ea42fCAa763d9857418224d9b025a,7812 ); _allocate(0xf470bbfeaB9B0d60e21FBd611C5d569df20704CE,7812 ); _allocate(0x31E985b4f7af6B479148d260309B7BcEcEF0fa7B,7812 ); _allocate(0x707D048708802Dc7730C722F8886105Ff07f0331,7812 ); _allocate(0xf2d2a2831f411F5cE863E8f836481dB0b40c03A5,7812 ); _allocate(0x716C9cC35607040f54b9232D35a2871F46894F58,6000 ); _allocate(0x81724bCe3D755AEB716d030cbD2c0f5b9f508Df0,5000 ); _allocate(0xE8CC2a8540C7339430859b8E7902AF2fE2d91865,4687 ); _allocate(0x268e1fEE56498Cc24758864AA092F870e8220f74,3906 ); _allocate(0xF93eD4Fe97eB8A2508D03222a28E332F1C89B0eD,3906 ); _allocate(0x65E27aD821D14E3567E97eb600728d2AAc7e1be4,3906 ); _allocate(0x001C88d92d199C9EB936Ed3D6758da7C48e4D08e,3906 ); _allocate(0x42c6Be1400578B238aCd8946FE9682E650DfdE8D,3906 ); _allocate(0x65E27aD821D14E3567E97eb600728d2AAc7e1be4,3906 ); _allocate(0xAcb272Eac895FA57394747615fCb068b8858AAF2,3906 ); _allocate(0x21eDE22Cb8Ab64F4F74128f3D0250a7851971A33,3906 ); _allocate(0x3DFf997410D94E2E3C961F805b85eB2Ef80622c5,3906 ); _allocate(0x8F70b3aC45A6896532FB90B992D5B7827bA88d3C,3906 ); _allocate(0xef6D6a51900B5cf220Fe54F8309B6Eda32e794E9,3906 ); _allocate(0x52BF55C77C402F90dF3Bc1d9E6a0faf262437ab1,3906 ); _allocate(0xa2639Ef1e7956b242E2C5Ac87b72B077FEbe2783,3906 ); _allocate(0x716C9cC35607040f54b9232D35a2871F46894F58,3906 ); _allocate(0x5826914A6223053038328ab3bc7CEB64db04DDc4,3515 ); _allocate(0x896Fa945c5533631F8DaFE7483FeA6859537cfD0,3125 ); _allocate(0x2d5304bA4f2c6EFF5D53CecF64AF89818A416cB9,3125 ); _allocate(0xD53354D4Fb7BcE81Cd4F83c457dbd5EF655C9E93,2734 ); _allocate(0x49216a6434B75051e9063E99Bb486bc85B0b0605,1953 ); _allocate(0xD53354D4Fb7BcE81Cd4F83c457dbd5EF655C9E93,1953 ); _allocate(0x4CEa5d86Bb0bBFa77CB452CCBD52e76dEA4dE045,1627 ); _allocate(0xC274362c1E85834Eb8387C18168C01aaEe2B00d7,1562 ); _allocate(0x18A8e216c3406dED40438856B45198B3ce39e522,1367 ); _allocate(0x51B3954e185869FB4cb9D2Bf9Fbd00A22900E800,477 ); } function saleOneAllocationsLocking() private { uint256 lockingPeriod = 24 hours; _allocateLock(0xCCa178a04D83Af193330C7927fb9a42212Fb1C25, 85932, lockingPeriod); _allocateLock(0xD7d7d68E4BDCf85c073485aB7Bfd151B0C019F1F, 39060, lockingPeriod); _allocateLock(0xf470bbfeaB9B0d60e21FBd611C5d569df20704CE, 31248, lockingPeriod); _allocateLock(0x9022BC8774AebC343De33423570b5285981bd9E1, 31248, lockingPeriod); _allocateLock(0xcf9Bb70b2f1aCCb846e8B0C665a1Ab5D5D35cA05, 31248, lockingPeriod); _allocateLock(0xfce0413BAD4E59f55946669E678EccFe87777777, 23436, lockingPeriod); _allocateLock(0xf470bbfeaB9B0d60e21FBd611C5d569df20704CE, 23436, lockingPeriod); _allocateLock(0xfEeA4Cd7a96dCffBDc6d2e6c814eb4544ab62667, 23436, lockingPeriod); _allocateLock(0xb4A0563DE6ABeE9C3C0631FbAE3444F012a40dB5, 19530, lockingPeriod); _allocateLock(0x54a9bB530474d287202Da7f4d5c9756E13f699f3, 15624, lockingPeriod); _allocateLock(0xEad249D58E4ebbFBf4ABbeCc1201bD88E50f7967, 15624, lockingPeriod); _allocateLock(0x3Dd4234DaeefBaBCeAA6068C04C3f75F19aa2cdA, 15624, lockingPeriod); _allocateLock(0x88F7541D87b7f3c88115A5b2387587263c5d4C7E, 11718, lockingPeriod); _allocateLock(0xf3e4D991a20043b6Bd025058CF4d96Fd7501070b, 11718, lockingPeriod); _allocateLock(0xEc315068A71458FB1A6cC063E9BC7369EC41a7a5, 8593, lockingPeriod); _allocateLock(0x54a9bB530474d287202Da7f4d5c9756E13f699f3, 7812, lockingPeriod); _allocateLock(0x0fEB352cfd10314af9abCF4eD03Da9311Bf8bC44, 7812, lockingPeriod); _allocateLock(0xd28932b8d4Be295D4B90b514EFa3E80436d66bEC, 7812, lockingPeriod); _allocateLock(0x268e1fEE56498Cc24758864AA092F870e8220f74, 7812, lockingPeriod); _allocateLock(0xDFF214084Fee648c8e0bc0838C1fa5E8548F58aC, 7812, lockingPeriod); _allocateLock(0x4356DdB30910c1f9b3Aa1e6A60111CE9802B6dF9, 7812, lockingPeriod); _allocateLock(0x863A3bD6f28f4F4A131c88708dA91076fDC362C7, 7812, lockingPeriod); _allocateLock(0x3F79B63823E435FaF08A95e0973b389333B19b99, 7812, lockingPeriod); _allocateLock(0x8F70b3aC45A6896532FB90B992D5B7827bA88d3C, 7812, lockingPeriod); _allocateLock(0xEc315068A71458FB1A6cC063E9BC7369EC41a7a5, 6640, lockingPeriod); _allocateLock(0x138EcD97Da1C9484263BfADDc1f3D6AE2a435bCb, 6250, lockingPeriod); _allocateLock(0x53A07d3c1Fdc58c0Cfd2c96817D9537A9E113dd4, 5468, lockingPeriod); _allocateLock(0xCEC0971e55A4C39e3e2C4d8f175CC6e53c138B0A, 4297, lockingPeriod); _allocateLock(0xBA682E593784f7654e4F92D58213dc495f229Eec, 3906, lockingPeriod); _allocateLock(0x9B9e35C223B39f908A036E41011D9E3aDb06ae0B, 3906, lockingPeriod); _allocateLock(0xBA98b69a140c078746219D0bBf0bb3b923483374, 3906, lockingPeriod); _allocateLock(0x34c4E14243a95b148534f894FCe86c61bC9F731a, 3906, lockingPeriod); _allocateLock(0x9A61567A3e3c5b47DFFB0670C629A40533Eb84d5, 3906, lockingPeriod); _allocateLock(0xda90dDbbdd4e0237C6889367c1556179c817680B, 3567, lockingPeriod); _allocateLock(0x329318Ca294A2d127e43058A7b23ED514B503d76, 2734, lockingPeriod); _allocateLock(0x7B3fC9597f146F0A80FC26dB0DdF62C04ea89740, 2578, lockingPeriod); _allocateLock(0xb6eC0d0172BC4Cff8fF669b543e03c2c8B64Fc5E, 2344, lockingPeriod); _allocateLock(0x53A07d3c1Fdc58c0Cfd2c96817D9537A9E113dd4, 2344, lockingPeriod); } function saleTwoAllocationsLocking() private { uint256 lockingPeriod = 12 hours; _allocateLock(0xc77c3EfB55bd7b0E44c13EB27eb33c98597f0a68, 16758, lockingPeriod); _allocateLock(0x9E817382A12D2b1D15246c4d383bEB8171BCdfA9, 13965, lockingPeriod); _allocateLock(0xfF6735CFf3DFED5d68dC3DbeBb0d34c5e815BA09, 11172, lockingPeriod); _allocateLock(0x5400087152e436C7C22883d01911868A3C892551, 7820, lockingPeriod); _allocateLock(0x974896E96219Dd508100f2Ad58921290655072aD, 5586, lockingPeriod); _allocateLock(0x0fEB352cfd10314af9abCF4eD03Da9311Bf8bC44, 5586, lockingPeriod); _allocateLock(0x268e1fEE56498Cc24758864AA092F870e8220f74, 5586, lockingPeriod); _allocateLock(0xC274362c1E85834Eb8387C18168C01aaEe2B00d7, 4469, lockingPeriod); _allocateLock(0x93935316db093A8665E91EE932591F76bf8E5295, 3631, lockingPeriod); _allocateLock(0x8bdBF4B19cb840e9Ac9B1eFFc2BfAd47591B5bF2, 2793, lockingPeriod); } function _allocateLock(address user, uint256 tokens, uint256 lockingPeriod) private{ uint256 startTime = 1599253200; // 4 sep walletsLocking[user].directRelease = true; walletsLocking[user].lockedTokens = tokens * 10 ** (decimals); walletsLocking[user].cliff = startTime.add(lockingPeriod); _allocate(user, tokens); } function _allocate(address user, uint256 tokens) private { balances[user] = balances[user].add(tokens * 10 ** (decimals)); emit Transfer(address(0),user, tokens * 10 ** (decimals)); } /** ERC20Interface function's implementation **/ function totalSupply() public override view returns (uint256){ return _totalSupply; } // ------------------------------------------------------------------------ // Get the token balance for account `tokenOwner` // ------------------------------------------------------------------------ function balanceOf(address tokenOwner) public override view returns (uint256 balance) { return balances[tokenOwner]; } // ------------------------------------------------------------------------ // Transfer the balance from token owner's account to `to` account // - Owner's account must have sufficient balance to transfer // - 0 value transfers are allowed // ------------------------------------------------------------------------ function transfer(address to, uint256 tokens) public override returns (bool success) { // prevent transfer to 0x0, use burn instead require(address(to) != address(0), "Transfer to address 0 not allowed"); require(balances[msg.sender] >= tokens, "SENDER: insufficient balance"); if (walletsLocking[msg.sender].lockedTokens > 0 ){ if(walletsLocking[msg.sender].directRelease) directRelease(msg.sender); else checkTime(msg.sender); } require(balances[msg.sender].sub(tokens) >= walletsLocking[msg.sender].lockedTokens, "Please wait for tokens to be released"); balances[msg.sender] = balances[msg.sender].sub(tokens); balances[to] = balances[to].add(tokens); emit Transfer(msg.sender, to, tokens); return true; } // ------------------------------------------------------------------------ // Token owner can approve for `spender` to transferFrom(...) `tokens` // from the token owner's account // ------------------------------------------------------------------------ function approve(address spender, uint256 tokens) public override returns (bool success){ allowed[msg.sender][spender] = tokens; emit Approval(msg.sender,spender,tokens); return true; } // ------------------------------------------------------------------------ // Transfer `tokens` from the `from` account to the `to` account // // The calling account must already have sufficient tokens approve(...)-d // for spending from the `from` account and // - From account must have sufficient balance to transfer // - Spender must have sufficient allowance to transfer // - 0 value transfers are allowed // ------------------------------------------------------------------------ function transferFrom(address from, address to, uint256 tokens) public override returns (bool success){ require(tokens <= allowed[from][msg.sender]); //check allowance // prevent transfer to 0x0, use burn instead require(address(to) != address(0), "Transfer to address 0 not allowed"); require(address(from) != address(0), "Transfer from address 0 not allowed"); require(balances[from] >= tokens, "SENDER: Insufficient balance"); if (walletsLocking[from].lockedTokens > 0){ if(walletsLocking[from].directRelease) directRelease(from); else checkTime(from); } require(balances[from].sub(tokens) >= walletsLocking[from].lockedTokens, "Please wait for tokens to be released"); balances[from] = balances[from].sub(tokens); balances[to] = balances[to].add(tokens); allowed[from][msg.sender] = allowed[from][msg.sender].sub(tokens); emit Transfer(from,to,tokens); return true; } // ------------------------------------------------------------------------ // Returns the amount of tokens approved by the owner that can be // transferred to the spender's account // ------------------------------------------------------------------------ function allowance(address tokenOwner, address spender) public override view returns (uint256 remaining) { return allowed[tokenOwner][spender]; } // ------------------------------------------------------------------------ // @dev Internal function that burns an amount of the token from a given account // @param _amount The amount that will be burnt // @param _account The tokens to burn from // can be used from account owner or contract owner // ------------------------------------------------------------------------ function burnTokens(uint256 _amount, address _account) public { require(msg.sender == _account || msg.sender == owner, "UnAuthorized"); require(balances[_account] >= _amount, "Insufficient account balance"); _totalSupply = _totalSupply.sub(_amount); balances[_account] = balances[_account].sub(_amount); emit Transfer(_account, address(0), _amount); } function directRelease(address _wallet) private{ if(block.timestamp > walletsLocking[_wallet].cliff){ walletsLocking[_wallet].lockedTokens = 0; } } function checkTime(address _wallet) private { // if cliff is applied if(block.timestamp > walletsLocking[_wallet].cliff){ uint256 timeSpanned = (now.sub(walletsLocking[_wallet].lastVisit)).div(walletsLocking[_wallet].releasePeriod); // if release period is passed if (timeSpanned >= 1){ uint256 released = timeSpanned.mul(walletsLocking[_wallet].releasePercentage); if (released > walletsLocking[_wallet].lockedTokens){ released = walletsLocking[_wallet].lockedTokens; } walletsLocking[_wallet].lastVisit = now; walletsLocking[_wallet].lockedTokens = walletsLocking[_wallet].lockedTokens.sub(released); } } } }
// ---------------------------------------------------------------------------- // ERC20 Token, with the addition of symbol, name and decimals and assisted // token transfers // ----------------------------------------------------------------------------
LineComment
burnTokens
function burnTokens(uint256 _amount, address _account) public { require(msg.sender == _account || msg.sender == owner, "UnAuthorized"); require(balances[_account] >= _amount, "Insufficient account balance"); _totalSupply = _totalSupply.sub(_amount); balances[_account] = balances[_account].sub(_amount); emit Transfer(_account, address(0), _amount); }
// ------------------------------------------------------------------------ // @dev Internal function that burns an amount of the token from a given account // @param _amount The amount that will be burnt // @param _account The tokens to burn from // can be used from account owner or contract owner // ------------------------------------------------------------------------
LineComment
v0.6.6+commit.6c089d02
Unlicense
ipfs://10e7056ffdb36de8e87f8f571f3b72a1fb3c1fd831e1b8ae606289c735dea39d
{ "func_code_index": [ 20065, 20471 ] }
1,044
PimmelToken
PimmelToken.sol
0x651a824c225e60c1901ec6018a685aa38d82f23c
Solidity
PimmelToken
contract PimmelToken { /* Public variables of the token */ 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 PimmelToken() { uint initialSupply = 28000000000000000000000000; balanceOf[msg.sender] = initialSupply; // Give the creator all initial tokens totalSupply = initialSupply; // Update total supply name = "Pimmel Token"; // Set the name for display purposes symbol = "PML"; // Set the symbol for display purposes decimals = 18; // Amount of decimals for display purposes } /* Internal transfer, only can be called by this contract */ function _transfer(address _from, address _to, uint _value) internal { require (_to != 0x0); // Prevent transfer to 0x0 address. Use burn() instead require (balanceOf[_from] > _value); // Check if the sender has enough require (balanceOf[_to] + _value > balanceOf[_to]); // Check for overflows balanceOf[_from] -= _value; // Subtract from the sender balanceOf[_to] += _value; // Add the same to the recipient Transfer(_from, _to, _value); } /// @notice Send `_value` tokens to `_to` from your account /// @param _to The address of the recipient /// @param _value the amount to send function transfer(address _to, uint256 _value) { _transfer(msg.sender, _to, _value); } /// @notice Send `_value` tokens to `_to` in behalf of `_from` /// @param _from The address of the sender /// @param _to The address of the recipient /// @param _value the amount to send function transferFrom(address _from, address _to, uint256 _value) returns (bool success) { require (_value < allowance[_from][msg.sender]); // Check allowance allowance[_from][msg.sender] -= _value; _transfer(_from, _to, _value); return true; } /// @notice Allows `_spender` to spend no more than `_value` tokens in your behalf /// @param _spender The address authorized to spend /// @param _value the max amount they can spend function approve(address _spender, uint256 _value) returns (bool success) { allowance[msg.sender][_spender] = _value; return true; } /// @notice Allows `_spender` to spend no more than `_value` tokens in your behalf, and then ping the contract about it /// @param _spender The address authorized to spend /// @param _value the max amount they can spend /// @param _extraData some extra information to send to the approved contract function approveAndCall(address _spender, uint256 _value, bytes _extraData) returns (bool success) { tokenRecipient spender = tokenRecipient(_spender); if (approve(_spender, _value)) { spender.receiveApproval(msg.sender, _value, this, _extraData); return true; } } /// @notice Remove `_value` tokens from the system irreversibly /// @param _value the amount of money to burn function burn(uint256 _value) returns (bool success) { require (balanceOf[msg.sender] > _value); // Check if the sender has enough balanceOf[msg.sender] -= _value; // Subtract from the sender totalSupply -= _value; // Updates totalSupply Burn(msg.sender, _value); return true; } function burnFrom(address _from, uint256 _value) returns (bool success) { require(balanceOf[_from] >= _value); // Check if the targeted balance is enough require(_value <= allowance[_from][msg.sender]); // Check allowance balanceOf[_from] -= _value; // Subtract from the targeted balance allowance[_from][msg.sender] -= _value; // Subtract from the sender's allowance totalSupply -= _value; // Update totalSupply Burn(_from, _value); return true; } }
PimmelToken
function PimmelToken() { uint initialSupply = 28000000000000000000000000; balanceOf[msg.sender] = initialSupply; // Give the creator all initial tokens totalSupply = initialSupply; // Update total supply name = "Pimmel Token"; // Set the name for display purposes symbol = "PML"; // 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.16+commit.d7661dd9
bzzr://11263c6d04359deefeafbf54b0d3f9786dd1481efd5ac7e2a19c5b8ab2b166ef
{ "func_code_index": [ 724, 1293 ] }
1,045
PimmelToken
PimmelToken.sol
0x651a824c225e60c1901ec6018a685aa38d82f23c
Solidity
PimmelToken
contract PimmelToken { /* Public variables of the token */ 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 PimmelToken() { uint initialSupply = 28000000000000000000000000; balanceOf[msg.sender] = initialSupply; // Give the creator all initial tokens totalSupply = initialSupply; // Update total supply name = "Pimmel Token"; // Set the name for display purposes symbol = "PML"; // Set the symbol for display purposes decimals = 18; // Amount of decimals for display purposes } /* Internal transfer, only can be called by this contract */ function _transfer(address _from, address _to, uint _value) internal { require (_to != 0x0); // Prevent transfer to 0x0 address. Use burn() instead require (balanceOf[_from] > _value); // Check if the sender has enough require (balanceOf[_to] + _value > balanceOf[_to]); // Check for overflows balanceOf[_from] -= _value; // Subtract from the sender balanceOf[_to] += _value; // Add the same to the recipient Transfer(_from, _to, _value); } /// @notice Send `_value` tokens to `_to` from your account /// @param _to The address of the recipient /// @param _value the amount to send function transfer(address _to, uint256 _value) { _transfer(msg.sender, _to, _value); } /// @notice Send `_value` tokens to `_to` in behalf of `_from` /// @param _from The address of the sender /// @param _to The address of the recipient /// @param _value the amount to send function transferFrom(address _from, address _to, uint256 _value) returns (bool success) { require (_value < allowance[_from][msg.sender]); // Check allowance allowance[_from][msg.sender] -= _value; _transfer(_from, _to, _value); return true; } /// @notice Allows `_spender` to spend no more than `_value` tokens in your behalf /// @param _spender The address authorized to spend /// @param _value the max amount they can spend function approve(address _spender, uint256 _value) returns (bool success) { allowance[msg.sender][_spender] = _value; return true; } /// @notice Allows `_spender` to spend no more than `_value` tokens in your behalf, and then ping the contract about it /// @param _spender The address authorized to spend /// @param _value the max amount they can spend /// @param _extraData some extra information to send to the approved contract function approveAndCall(address _spender, uint256 _value, bytes _extraData) returns (bool success) { tokenRecipient spender = tokenRecipient(_spender); if (approve(_spender, _value)) { spender.receiveApproval(msg.sender, _value, this, _extraData); return true; } } /// @notice Remove `_value` tokens from the system irreversibly /// @param _value the amount of money to burn function burn(uint256 _value) returns (bool success) { require (balanceOf[msg.sender] > _value); // Check if the sender has enough balanceOf[msg.sender] -= _value; // Subtract from the sender totalSupply -= _value; // Updates totalSupply Burn(msg.sender, _value); return true; } function burnFrom(address _from, uint256 _value) returns (bool success) { require(balanceOf[_from] >= _value); // Check if the targeted balance is enough require(_value <= allowance[_from][msg.sender]); // Check allowance balanceOf[_from] -= _value; // Subtract from the targeted balance allowance[_from][msg.sender] -= _value; // Subtract from the sender's allowance totalSupply -= _value; // Update totalSupply Burn(_from, _value); return true; } }
_transfer
function _transfer(address _from, address _to, uint _value) internal { require (_to != 0x0); // Prevent transfer to 0x0 address. Use burn() instead require (balanceOf[_from] > _value); // Check if the sender has enough require (balanceOf[_to] + _value > balanceOf[_to]); // Check for overflows balanceOf[_from] -= _value; // Subtract from the sender balanceOf[_to] += _value; // Add the same to the recipient Transfer(_from, _to, _value); }
/* Internal transfer, only can be called by this contract */
Comment
v0.4.16+commit.d7661dd9
bzzr://11263c6d04359deefeafbf54b0d3f9786dd1481efd5ac7e2a19c5b8ab2b166ef
{ "func_code_index": [ 1362, 1962 ] }
1,046
PimmelToken
PimmelToken.sol
0x651a824c225e60c1901ec6018a685aa38d82f23c
Solidity
PimmelToken
contract PimmelToken { /* Public variables of the token */ 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 PimmelToken() { uint initialSupply = 28000000000000000000000000; balanceOf[msg.sender] = initialSupply; // Give the creator all initial tokens totalSupply = initialSupply; // Update total supply name = "Pimmel Token"; // Set the name for display purposes symbol = "PML"; // Set the symbol for display purposes decimals = 18; // Amount of decimals for display purposes } /* Internal transfer, only can be called by this contract */ function _transfer(address _from, address _to, uint _value) internal { require (_to != 0x0); // Prevent transfer to 0x0 address. Use burn() instead require (balanceOf[_from] > _value); // Check if the sender has enough require (balanceOf[_to] + _value > balanceOf[_to]); // Check for overflows balanceOf[_from] -= _value; // Subtract from the sender balanceOf[_to] += _value; // Add the same to the recipient Transfer(_from, _to, _value); } /// @notice Send `_value` tokens to `_to` from your account /// @param _to The address of the recipient /// @param _value the amount to send function transfer(address _to, uint256 _value) { _transfer(msg.sender, _to, _value); } /// @notice Send `_value` tokens to `_to` in behalf of `_from` /// @param _from The address of the sender /// @param _to The address of the recipient /// @param _value the amount to send function transferFrom(address _from, address _to, uint256 _value) returns (bool success) { require (_value < allowance[_from][msg.sender]); // Check allowance allowance[_from][msg.sender] -= _value; _transfer(_from, _to, _value); return true; } /// @notice Allows `_spender` to spend no more than `_value` tokens in your behalf /// @param _spender The address authorized to spend /// @param _value the max amount they can spend function approve(address _spender, uint256 _value) returns (bool success) { allowance[msg.sender][_spender] = _value; return true; } /// @notice Allows `_spender` to spend no more than `_value` tokens in your behalf, and then ping the contract about it /// @param _spender The address authorized to spend /// @param _value the max amount they can spend /// @param _extraData some extra information to send to the approved contract function approveAndCall(address _spender, uint256 _value, bytes _extraData) returns (bool success) { tokenRecipient spender = tokenRecipient(_spender); if (approve(_spender, _value)) { spender.receiveApproval(msg.sender, _value, this, _extraData); return true; } } /// @notice Remove `_value` tokens from the system irreversibly /// @param _value the amount of money to burn function burn(uint256 _value) returns (bool success) { require (balanceOf[msg.sender] > _value); // Check if the sender has enough balanceOf[msg.sender] -= _value; // Subtract from the sender totalSupply -= _value; // Updates totalSupply Burn(msg.sender, _value); return true; } function burnFrom(address _from, uint256 _value) returns (bool success) { require(balanceOf[_from] >= _value); // Check if the targeted balance is enough require(_value <= allowance[_from][msg.sender]); // Check allowance balanceOf[_from] -= _value; // Subtract from the targeted balance allowance[_from][msg.sender] -= _value; // Subtract from the sender's allowance totalSupply -= _value; // Update totalSupply Burn(_from, _value); return true; } }
transfer
function transfer(address _to, uint256 _value) { _transfer(msg.sender, _to, _value); }
/// @notice Send `_value` tokens to `_to` from your account /// @param _to The address of the recipient /// @param _value the amount to send
NatSpecSingleLine
v0.4.16+commit.d7661dd9
bzzr://11263c6d04359deefeafbf54b0d3f9786dd1481efd5ac7e2a19c5b8ab2b166ef
{ "func_code_index": [ 2121, 2226 ] }
1,047
PimmelToken
PimmelToken.sol
0x651a824c225e60c1901ec6018a685aa38d82f23c
Solidity
PimmelToken
contract PimmelToken { /* Public variables of the token */ 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 PimmelToken() { uint initialSupply = 28000000000000000000000000; balanceOf[msg.sender] = initialSupply; // Give the creator all initial tokens totalSupply = initialSupply; // Update total supply name = "Pimmel Token"; // Set the name for display purposes symbol = "PML"; // Set the symbol for display purposes decimals = 18; // Amount of decimals for display purposes } /* Internal transfer, only can be called by this contract */ function _transfer(address _from, address _to, uint _value) internal { require (_to != 0x0); // Prevent transfer to 0x0 address. Use burn() instead require (balanceOf[_from] > _value); // Check if the sender has enough require (balanceOf[_to] + _value > balanceOf[_to]); // Check for overflows balanceOf[_from] -= _value; // Subtract from the sender balanceOf[_to] += _value; // Add the same to the recipient Transfer(_from, _to, _value); } /// @notice Send `_value` tokens to `_to` from your account /// @param _to The address of the recipient /// @param _value the amount to send function transfer(address _to, uint256 _value) { _transfer(msg.sender, _to, _value); } /// @notice Send `_value` tokens to `_to` in behalf of `_from` /// @param _from The address of the sender /// @param _to The address of the recipient /// @param _value the amount to send function transferFrom(address _from, address _to, uint256 _value) returns (bool success) { require (_value < allowance[_from][msg.sender]); // Check allowance allowance[_from][msg.sender] -= _value; _transfer(_from, _to, _value); return true; } /// @notice Allows `_spender` to spend no more than `_value` tokens in your behalf /// @param _spender The address authorized to spend /// @param _value the max amount they can spend function approve(address _spender, uint256 _value) returns (bool success) { allowance[msg.sender][_spender] = _value; return true; } /// @notice Allows `_spender` to spend no more than `_value` tokens in your behalf, and then ping the contract about it /// @param _spender The address authorized to spend /// @param _value the max amount they can spend /// @param _extraData some extra information to send to the approved contract function approveAndCall(address _spender, uint256 _value, bytes _extraData) returns (bool success) { tokenRecipient spender = tokenRecipient(_spender); if (approve(_spender, _value)) { spender.receiveApproval(msg.sender, _value, this, _extraData); return true; } } /// @notice Remove `_value` tokens from the system irreversibly /// @param _value the amount of money to burn function burn(uint256 _value) returns (bool success) { require (balanceOf[msg.sender] > _value); // Check if the sender has enough balanceOf[msg.sender] -= _value; // Subtract from the sender totalSupply -= _value; // Updates totalSupply Burn(msg.sender, _value); return true; } function burnFrom(address _from, uint256 _value) returns (bool success) { require(balanceOf[_from] >= _value); // Check if the targeted balance is enough require(_value <= allowance[_from][msg.sender]); // Check allowance balanceOf[_from] -= _value; // Subtract from the targeted balance allowance[_from][msg.sender] -= _value; // Subtract from the sender's allowance totalSupply -= _value; // Update totalSupply Burn(_from, _value); return true; } }
transferFrom
function transferFrom(address _from, address _to, uint256 _value) returns (bool success) { require (_value < allowance[_from][msg.sender]); // Check allowance allowance[_from][msg.sender] -= _value; _transfer(_from, _to, _value); return true; }
/// @notice Send `_value` tokens to `_to` in behalf of `_from` /// @param _from The address of the sender /// @param _to The address of the recipient /// @param _value the amount to send
NatSpecSingleLine
v0.4.16+commit.d7661dd9
bzzr://11263c6d04359deefeafbf54b0d3f9786dd1481efd5ac7e2a19c5b8ab2b166ef
{ "func_code_index": [ 2436, 2730 ] }
1,048
PimmelToken
PimmelToken.sol
0x651a824c225e60c1901ec6018a685aa38d82f23c
Solidity
PimmelToken
contract PimmelToken { /* Public variables of the token */ 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 PimmelToken() { uint initialSupply = 28000000000000000000000000; balanceOf[msg.sender] = initialSupply; // Give the creator all initial tokens totalSupply = initialSupply; // Update total supply name = "Pimmel Token"; // Set the name for display purposes symbol = "PML"; // Set the symbol for display purposes decimals = 18; // Amount of decimals for display purposes } /* Internal transfer, only can be called by this contract */ function _transfer(address _from, address _to, uint _value) internal { require (_to != 0x0); // Prevent transfer to 0x0 address. Use burn() instead require (balanceOf[_from] > _value); // Check if the sender has enough require (balanceOf[_to] + _value > balanceOf[_to]); // Check for overflows balanceOf[_from] -= _value; // Subtract from the sender balanceOf[_to] += _value; // Add the same to the recipient Transfer(_from, _to, _value); } /// @notice Send `_value` tokens to `_to` from your account /// @param _to The address of the recipient /// @param _value the amount to send function transfer(address _to, uint256 _value) { _transfer(msg.sender, _to, _value); } /// @notice Send `_value` tokens to `_to` in behalf of `_from` /// @param _from The address of the sender /// @param _to The address of the recipient /// @param _value the amount to send function transferFrom(address _from, address _to, uint256 _value) returns (bool success) { require (_value < allowance[_from][msg.sender]); // Check allowance allowance[_from][msg.sender] -= _value; _transfer(_from, _to, _value); return true; } /// @notice Allows `_spender` to spend no more than `_value` tokens in your behalf /// @param _spender The address authorized to spend /// @param _value the max amount they can spend function approve(address _spender, uint256 _value) returns (bool success) { allowance[msg.sender][_spender] = _value; return true; } /// @notice Allows `_spender` to spend no more than `_value` tokens in your behalf, and then ping the contract about it /// @param _spender The address authorized to spend /// @param _value the max amount they can spend /// @param _extraData some extra information to send to the approved contract function approveAndCall(address _spender, uint256 _value, bytes _extraData) returns (bool success) { tokenRecipient spender = tokenRecipient(_spender); if (approve(_spender, _value)) { spender.receiveApproval(msg.sender, _value, this, _extraData); return true; } } /// @notice Remove `_value` tokens from the system irreversibly /// @param _value the amount of money to burn function burn(uint256 _value) returns (bool success) { require (balanceOf[msg.sender] > _value); // Check if the sender has enough balanceOf[msg.sender] -= _value; // Subtract from the sender totalSupply -= _value; // Updates totalSupply Burn(msg.sender, _value); return true; } function burnFrom(address _from, uint256 _value) returns (bool success) { require(balanceOf[_from] >= _value); // Check if the targeted balance is enough require(_value <= allowance[_from][msg.sender]); // Check allowance balanceOf[_from] -= _value; // Subtract from the targeted balance allowance[_from][msg.sender] -= _value; // Subtract from the sender's allowance totalSupply -= _value; // Update totalSupply Burn(_from, _value); return true; } }
approve
function approve(address _spender, uint256 _value) returns (bool success) { allowance[msg.sender][_spender] = _value; return true; }
/// @notice Allows `_spender` to spend no more than `_value` tokens in your behalf /// @param _spender The address authorized to spend /// @param _value the max amount they can spend
NatSpecSingleLine
v0.4.16+commit.d7661dd9
bzzr://11263c6d04359deefeafbf54b0d3f9786dd1481efd5ac7e2a19c5b8ab2b166ef
{ "func_code_index": [ 2931, 3100 ] }
1,049
PimmelToken
PimmelToken.sol
0x651a824c225e60c1901ec6018a685aa38d82f23c
Solidity
PimmelToken
contract PimmelToken { /* Public variables of the token */ 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 PimmelToken() { uint initialSupply = 28000000000000000000000000; balanceOf[msg.sender] = initialSupply; // Give the creator all initial tokens totalSupply = initialSupply; // Update total supply name = "Pimmel Token"; // Set the name for display purposes symbol = "PML"; // Set the symbol for display purposes decimals = 18; // Amount of decimals for display purposes } /* Internal transfer, only can be called by this contract */ function _transfer(address _from, address _to, uint _value) internal { require (_to != 0x0); // Prevent transfer to 0x0 address. Use burn() instead require (balanceOf[_from] > _value); // Check if the sender has enough require (balanceOf[_to] + _value > balanceOf[_to]); // Check for overflows balanceOf[_from] -= _value; // Subtract from the sender balanceOf[_to] += _value; // Add the same to the recipient Transfer(_from, _to, _value); } /// @notice Send `_value` tokens to `_to` from your account /// @param _to The address of the recipient /// @param _value the amount to send function transfer(address _to, uint256 _value) { _transfer(msg.sender, _to, _value); } /// @notice Send `_value` tokens to `_to` in behalf of `_from` /// @param _from The address of the sender /// @param _to The address of the recipient /// @param _value the amount to send function transferFrom(address _from, address _to, uint256 _value) returns (bool success) { require (_value < allowance[_from][msg.sender]); // Check allowance allowance[_from][msg.sender] -= _value; _transfer(_from, _to, _value); return true; } /// @notice Allows `_spender` to spend no more than `_value` tokens in your behalf /// @param _spender The address authorized to spend /// @param _value the max amount they can spend function approve(address _spender, uint256 _value) returns (bool success) { allowance[msg.sender][_spender] = _value; return true; } /// @notice Allows `_spender` to spend no more than `_value` tokens in your behalf, and then ping the contract about it /// @param _spender The address authorized to spend /// @param _value the max amount they can spend /// @param _extraData some extra information to send to the approved contract function approveAndCall(address _spender, uint256 _value, bytes _extraData) returns (bool success) { tokenRecipient spender = tokenRecipient(_spender); if (approve(_spender, _value)) { spender.receiveApproval(msg.sender, _value, this, _extraData); return true; } } /// @notice Remove `_value` tokens from the system irreversibly /// @param _value the amount of money to burn function burn(uint256 _value) returns (bool success) { require (balanceOf[msg.sender] > _value); // Check if the sender has enough balanceOf[msg.sender] -= _value; // Subtract from the sender totalSupply -= _value; // Updates totalSupply Burn(msg.sender, _value); return true; } function burnFrom(address _from, uint256 _value) returns (bool success) { require(balanceOf[_from] >= _value); // Check if the targeted balance is enough require(_value <= allowance[_from][msg.sender]); // Check allowance balanceOf[_from] -= _value; // Subtract from the targeted balance allowance[_from][msg.sender] -= _value; // Subtract from the sender's allowance totalSupply -= _value; // Update totalSupply 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; } }
/// @notice Allows `_spender` to spend no more than `_value` tokens in your behalf, and then ping the contract about it /// @param _spender The address authorized to spend /// @param _value the max amount they can spend /// @param _extraData some extra information to send to the approved contract
NatSpecSingleLine
v0.4.16+commit.d7661dd9
bzzr://11263c6d04359deefeafbf54b0d3f9786dd1481efd5ac7e2a19c5b8ab2b166ef
{ "func_code_index": [ 3421, 3765 ] }
1,050
PimmelToken
PimmelToken.sol
0x651a824c225e60c1901ec6018a685aa38d82f23c
Solidity
PimmelToken
contract PimmelToken { /* Public variables of the token */ 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 PimmelToken() { uint initialSupply = 28000000000000000000000000; balanceOf[msg.sender] = initialSupply; // Give the creator all initial tokens totalSupply = initialSupply; // Update total supply name = "Pimmel Token"; // Set the name for display purposes symbol = "PML"; // Set the symbol for display purposes decimals = 18; // Amount of decimals for display purposes } /* Internal transfer, only can be called by this contract */ function _transfer(address _from, address _to, uint _value) internal { require (_to != 0x0); // Prevent transfer to 0x0 address. Use burn() instead require (balanceOf[_from] > _value); // Check if the sender has enough require (balanceOf[_to] + _value > balanceOf[_to]); // Check for overflows balanceOf[_from] -= _value; // Subtract from the sender balanceOf[_to] += _value; // Add the same to the recipient Transfer(_from, _to, _value); } /// @notice Send `_value` tokens to `_to` from your account /// @param _to The address of the recipient /// @param _value the amount to send function transfer(address _to, uint256 _value) { _transfer(msg.sender, _to, _value); } /// @notice Send `_value` tokens to `_to` in behalf of `_from` /// @param _from The address of the sender /// @param _to The address of the recipient /// @param _value the amount to send function transferFrom(address _from, address _to, uint256 _value) returns (bool success) { require (_value < allowance[_from][msg.sender]); // Check allowance allowance[_from][msg.sender] -= _value; _transfer(_from, _to, _value); return true; } /// @notice Allows `_spender` to spend no more than `_value` tokens in your behalf /// @param _spender The address authorized to spend /// @param _value the max amount they can spend function approve(address _spender, uint256 _value) returns (bool success) { allowance[msg.sender][_spender] = _value; return true; } /// @notice Allows `_spender` to spend no more than `_value` tokens in your behalf, and then ping the contract about it /// @param _spender The address authorized to spend /// @param _value the max amount they can spend /// @param _extraData some extra information to send to the approved contract function approveAndCall(address _spender, uint256 _value, bytes _extraData) returns (bool success) { tokenRecipient spender = tokenRecipient(_spender); if (approve(_spender, _value)) { spender.receiveApproval(msg.sender, _value, this, _extraData); return true; } } /// @notice Remove `_value` tokens from the system irreversibly /// @param _value the amount of money to burn function burn(uint256 _value) returns (bool success) { require (balanceOf[msg.sender] > _value); // Check if the sender has enough balanceOf[msg.sender] -= _value; // Subtract from the sender totalSupply -= _value; // Updates totalSupply Burn(msg.sender, _value); return true; } function burnFrom(address _from, uint256 _value) returns (bool success) { require(balanceOf[_from] >= _value); // Check if the targeted balance is enough require(_value <= allowance[_from][msg.sender]); // Check allowance balanceOf[_from] -= _value; // Subtract from the targeted balance allowance[_from][msg.sender] -= _value; // Subtract from the sender's allowance totalSupply -= _value; // Update totalSupply Burn(_from, _value); return true; } }
burn
function burn(uint256 _value) returns (bool success) { require (balanceOf[msg.sender] > _value); // Check if the sender has enough balanceOf[msg.sender] -= _value; // Subtract from the sender totalSupply -= _value; // Updates totalSupply Burn(msg.sender, _value); return true; }
/// @notice Remove `_value` tokens from the system irreversibly /// @param _value the amount of money to burn
NatSpecSingleLine
v0.4.16+commit.d7661dd9
bzzr://11263c6d04359deefeafbf54b0d3f9786dd1481efd5ac7e2a19c5b8ab2b166ef
{ "func_code_index": [ 3888, 4284 ] }
1,051
MillennialzApp
MillennialzApp.sol
0xfa74500d028c25798ef6854380a81c7f07b26ea8
Solidity
MillennialzApp
contract MillennialzApp is ERC20 { using SafeMath for uint256; address owner = msg.sender; mapping (address => uint256) balances; mapping (address => mapping (address => uint256)) allowed; string public constant name = "MillennialzApp"; //* Token Name *// string public constant symbol = "MLZ"; //* MillennialzApp Symbol *// uint public constant decimals = 8; //* Number of Decimals *// uint256 public totalSupply = 100000000000000000; //* total supply of MillennialzApp *// uint256 public totalDistributed = 100000000; //* Initial MillennialzApp that will give to contract creator *// uint256 public constant MIN = 1 ether / 100; //* Minimum Contribution for MillennialzApp // uint256 public tokensPerEth = 558200000000; //* MillennialzApp Amount per Ethereum *// event Transfer(address indexed _from, address indexed _to, uint256 _value); event Approval(address indexed _owner, address indexed _spender, uint256 _value); event Distr(address indexed to, uint256 amount); event DistrFinished(); event Airdrop(address indexed _owner, uint _amount, uint _balance); event TokensPerEthUpdated(uint _tokensPerEth); event Burn(address indexed burner, uint256 value); event Freeze(address indexed from, uint256 value); //event freezing event Unfreeze(address indexed from, uint256 value); //event Unfreezing bool public distributionFinished = false; modifier canDistr() { require(!distributionFinished); _; } modifier onlyOwner() { require(msg.sender == owner); _; } function MillennialzApp () public { owner = msg.sender; distr(owner, totalDistributed); } function transferOwnership(address newOwner) onlyOwner public { if (newOwner != address(0)) { owner = newOwner; } } function finishDistribution() onlyOwner canDistr public returns (bool) { distributionFinished = true; emit DistrFinished(); return true; } function distr(address _to, uint256 _amount) canDistr private returns (bool) { totalDistributed = totalDistributed.add(_amount); balances[_to] = balances[_to].add(_amount); emit Distr(_to, _amount); emit Transfer(address(0), _to, _amount); return true; } function doAirdrop(address _participant, uint _amount) internal { require( _amount > 0 ); require( totalDistributed < totalSupply ); balances[_participant] = balances[_participant].add(_amount); totalDistributed = totalDistributed.add(_amount); if (totalDistributed >= totalSupply) { distributionFinished = true; } emit Airdrop(_participant, _amount, balances[_participant]); emit Transfer(address(0), _participant, _amount); } function AirdropSingle(address _participant, uint _amount) public onlyOwner { doAirdrop(_participant, _amount); } function AirdropMultiple(address[] _addresses, uint _amount) public onlyOwner { for (uint i = 0; i < _addresses.length; i++) doAirdrop(_addresses[i], _amount); } function updateTokensPerEth(uint _tokensPerEth) public onlyOwner { tokensPerEth = _tokensPerEth; emit TokensPerEthUpdated(_tokensPerEth); } function () external payable { getTokens(); } function getTokens() payable canDistr public { uint256 tokens = 0; require( msg.value >= MIN ); require( msg.value > 0 ); tokens = tokensPerEth.mul(msg.value) / 1 ether; address investor = msg.sender; if (tokens > 0) { distr(investor, tokens); } if (totalDistributed >= totalSupply) { distributionFinished = true; } } modifier onlyPayloadSize(uint size) { assert(msg.data.length >= size + 4); _; } function balanceOf(address _owner) constant public returns (uint256) { return balances[_owner]; } function freeze(uint256 _value) returns (bool success) { if (balances[msg.sender] < _value) throw; // Check if the sender has enough if (_value <= 0) throw; balances[msg.sender] = SafeMath.sub(balances[msg.sender], _value); // Subtract from the sender freezeOf[msg.sender] = SafeMath.add(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.sub(freezeOf[msg.sender], _value); // Subtract from the sender balances[msg.sender] = SafeMath.add(balances[msg.sender], _value); Unfreeze(msg.sender, _value); return true; } function transfer(address _to, uint256 _amount) onlyPayloadSize(2 * 32) public returns (bool success) { //check if sender has balance and for oveflow require(_to != address(0)); require(_amount <= balances[msg.sender]); balances[msg.sender] = balances[msg.sender].sub(_amount); balances[_to] = balances[_to].add(_amount); emit Transfer(msg.sender, _to, _amount); return true; } function transferFrom(address _from, address _to, uint256 _amount) onlyPayloadSize(3 * 32) public returns (bool success) { require(_to != address(0)); require(_amount <= balances[_from]); require(_amount <= allowed[_from][msg.sender]); balances[_from] = balances[_from].sub(_amount); allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_amount); balances[_to] = balances[_to].add(_amount); emit Transfer(_from, _to, _amount); return true; } //allow the contract owner to withdraw any token that are not belongs to MillennialzApp Community function withdrawForeignTokens(address _tokenContract) onlyOwner public returns (bool) { ForeignToken token = ForeignToken(_tokenContract); uint256 amount = token.balanceOf(address(this)); return token.transfer(owner, amount); } //withdraw foreign tokens function approve(address _spender, uint256 _value) public returns (bool success) { if (_value != 0 && allowed[msg.sender][_spender] != 0) { return false; } allowed[msg.sender][_spender] = _value; emit Approval(msg.sender, _spender, _value); return true; } function getTokenBalance(address tokenAddress, address who) constant public returns (uint){ ForeignToken t = ForeignToken(tokenAddress); uint bal = t.balanceOf(who); return bal; } //withdraw Ethereum from Contract address function withdrawEther() onlyOwner public { address myAddress = this; uint256 etherBalance = myAddress.balance; owner.transfer(etherBalance); } function allowance(address _owner, address _spender) constant public returns (uint256) { return allowed[_owner][_spender]; } //Burning specific amount of MillennialzApp function burnMillennialzApp(uint256 _value) onlyOwner public { require(_value <= balances[msg.sender]); address burner = msg.sender; balances[burner] = balances[burner].sub(_value); totalSupply = totalSupply.sub(_value); totalDistributed = totalDistributed.sub(_value); emit Burn(burner, _value); } }
withdrawForeignTokens
function withdrawForeignTokens(address _tokenContract) onlyOwner public returns (bool) { ForeignToken token = ForeignToken(_tokenContract); uint256 amount = token.balanceOf(address(this)); return token.transfer(owner, amount); //withdraw foreign tokens
//allow the contract owner to withdraw any token that are not belongs to MillennialzApp Community
LineComment
v0.4.26+commit.4563c3fc
None
bzzr://7cefdadd8697c38652e1c0570d5dab038b71f33fc828aa549003efde88b43193
{ "func_code_index": [ 6313, 6605 ] }
1,052
MillennialzApp
MillennialzApp.sol
0xfa74500d028c25798ef6854380a81c7f07b26ea8
Solidity
MillennialzApp
contract MillennialzApp is ERC20 { using SafeMath for uint256; address owner = msg.sender; mapping (address => uint256) balances; mapping (address => mapping (address => uint256)) allowed; string public constant name = "MillennialzApp"; //* Token Name *// string public constant symbol = "MLZ"; //* MillennialzApp Symbol *// uint public constant decimals = 8; //* Number of Decimals *// uint256 public totalSupply = 100000000000000000; //* total supply of MillennialzApp *// uint256 public totalDistributed = 100000000; //* Initial MillennialzApp that will give to contract creator *// uint256 public constant MIN = 1 ether / 100; //* Minimum Contribution for MillennialzApp // uint256 public tokensPerEth = 558200000000; //* MillennialzApp Amount per Ethereum *// event Transfer(address indexed _from, address indexed _to, uint256 _value); event Approval(address indexed _owner, address indexed _spender, uint256 _value); event Distr(address indexed to, uint256 amount); event DistrFinished(); event Airdrop(address indexed _owner, uint _amount, uint _balance); event TokensPerEthUpdated(uint _tokensPerEth); event Burn(address indexed burner, uint256 value); event Freeze(address indexed from, uint256 value); //event freezing event Unfreeze(address indexed from, uint256 value); //event Unfreezing bool public distributionFinished = false; modifier canDistr() { require(!distributionFinished); _; } modifier onlyOwner() { require(msg.sender == owner); _; } function MillennialzApp () public { owner = msg.sender; distr(owner, totalDistributed); } function transferOwnership(address newOwner) onlyOwner public { if (newOwner != address(0)) { owner = newOwner; } } function finishDistribution() onlyOwner canDistr public returns (bool) { distributionFinished = true; emit DistrFinished(); return true; } function distr(address _to, uint256 _amount) canDistr private returns (bool) { totalDistributed = totalDistributed.add(_amount); balances[_to] = balances[_to].add(_amount); emit Distr(_to, _amount); emit Transfer(address(0), _to, _amount); return true; } function doAirdrop(address _participant, uint _amount) internal { require( _amount > 0 ); require( totalDistributed < totalSupply ); balances[_participant] = balances[_participant].add(_amount); totalDistributed = totalDistributed.add(_amount); if (totalDistributed >= totalSupply) { distributionFinished = true; } emit Airdrop(_participant, _amount, balances[_participant]); emit Transfer(address(0), _participant, _amount); } function AirdropSingle(address _participant, uint _amount) public onlyOwner { doAirdrop(_participant, _amount); } function AirdropMultiple(address[] _addresses, uint _amount) public onlyOwner { for (uint i = 0; i < _addresses.length; i++) doAirdrop(_addresses[i], _amount); } function updateTokensPerEth(uint _tokensPerEth) public onlyOwner { tokensPerEth = _tokensPerEth; emit TokensPerEthUpdated(_tokensPerEth); } function () external payable { getTokens(); } function getTokens() payable canDistr public { uint256 tokens = 0; require( msg.value >= MIN ); require( msg.value > 0 ); tokens = tokensPerEth.mul(msg.value) / 1 ether; address investor = msg.sender; if (tokens > 0) { distr(investor, tokens); } if (totalDistributed >= totalSupply) { distributionFinished = true; } } modifier onlyPayloadSize(uint size) { assert(msg.data.length >= size + 4); _; } function balanceOf(address _owner) constant public returns (uint256) { return balances[_owner]; } function freeze(uint256 _value) returns (bool success) { if (balances[msg.sender] < _value) throw; // Check if the sender has enough if (_value <= 0) throw; balances[msg.sender] = SafeMath.sub(balances[msg.sender], _value); // Subtract from the sender freezeOf[msg.sender] = SafeMath.add(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.sub(freezeOf[msg.sender], _value); // Subtract from the sender balances[msg.sender] = SafeMath.add(balances[msg.sender], _value); Unfreeze(msg.sender, _value); return true; } function transfer(address _to, uint256 _amount) onlyPayloadSize(2 * 32) public returns (bool success) { //check if sender has balance and for oveflow require(_to != address(0)); require(_amount <= balances[msg.sender]); balances[msg.sender] = balances[msg.sender].sub(_amount); balances[_to] = balances[_to].add(_amount); emit Transfer(msg.sender, _to, _amount); return true; } function transferFrom(address _from, address _to, uint256 _amount) onlyPayloadSize(3 * 32) public returns (bool success) { require(_to != address(0)); require(_amount <= balances[_from]); require(_amount <= allowed[_from][msg.sender]); balances[_from] = balances[_from].sub(_amount); allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_amount); balances[_to] = balances[_to].add(_amount); emit Transfer(_from, _to, _amount); return true; } //allow the contract owner to withdraw any token that are not belongs to MillennialzApp Community function withdrawForeignTokens(address _tokenContract) onlyOwner public returns (bool) { ForeignToken token = ForeignToken(_tokenContract); uint256 amount = token.balanceOf(address(this)); return token.transfer(owner, amount); } //withdraw foreign tokens function approve(address _spender, uint256 _value) public returns (bool success) { if (_value != 0 && allowed[msg.sender][_spender] != 0) { return false; } allowed[msg.sender][_spender] = _value; emit Approval(msg.sender, _spender, _value); return true; } function getTokenBalance(address tokenAddress, address who) constant public returns (uint){ ForeignToken t = ForeignToken(tokenAddress); uint bal = t.balanceOf(who); return bal; } //withdraw Ethereum from Contract address function withdrawEther() onlyOwner public { address myAddress = this; uint256 etherBalance = myAddress.balance; owner.transfer(etherBalance); } function allowance(address _owner, address _spender) constant public returns (uint256) { return allowed[_owner][_spender]; } //Burning specific amount of MillennialzApp function burnMillennialzApp(uint256 _value) onlyOwner public { require(_value <= balances[msg.sender]); address burner = msg.sender; balances[burner] = balances[burner].sub(_value); totalSupply = totalSupply.sub(_value); totalDistributed = totalDistributed.sub(_value); emit Burn(burner, _value); } }
approve
function approve(address _spender, uint256 _value) public returns (bool success) { if (_value != 0 && allowed[msg.sender][_spender] != 0) { return false; } allowed[msg.sender][_spender] = _value; emit Approval(msg.sender, _spender, _value); return true; }
//withdraw foreign tokens
LineComment
v0.4.26+commit.4563c3fc
None
bzzr://7cefdadd8697c38652e1c0570d5dab038b71f33fc828aa549003efde88b43193
{ "func_code_index": [ 6612, 6914 ] }
1,053
MillennialzApp
MillennialzApp.sol
0xfa74500d028c25798ef6854380a81c7f07b26ea8
Solidity
MillennialzApp
contract MillennialzApp is ERC20 { using SafeMath for uint256; address owner = msg.sender; mapping (address => uint256) balances; mapping (address => mapping (address => uint256)) allowed; string public constant name = "MillennialzApp"; //* Token Name *// string public constant symbol = "MLZ"; //* MillennialzApp Symbol *// uint public constant decimals = 8; //* Number of Decimals *// uint256 public totalSupply = 100000000000000000; //* total supply of MillennialzApp *// uint256 public totalDistributed = 100000000; //* Initial MillennialzApp that will give to contract creator *// uint256 public constant MIN = 1 ether / 100; //* Minimum Contribution for MillennialzApp // uint256 public tokensPerEth = 558200000000; //* MillennialzApp Amount per Ethereum *// event Transfer(address indexed _from, address indexed _to, uint256 _value); event Approval(address indexed _owner, address indexed _spender, uint256 _value); event Distr(address indexed to, uint256 amount); event DistrFinished(); event Airdrop(address indexed _owner, uint _amount, uint _balance); event TokensPerEthUpdated(uint _tokensPerEth); event Burn(address indexed burner, uint256 value); event Freeze(address indexed from, uint256 value); //event freezing event Unfreeze(address indexed from, uint256 value); //event Unfreezing bool public distributionFinished = false; modifier canDistr() { require(!distributionFinished); _; } modifier onlyOwner() { require(msg.sender == owner); _; } function MillennialzApp () public { owner = msg.sender; distr(owner, totalDistributed); } function transferOwnership(address newOwner) onlyOwner public { if (newOwner != address(0)) { owner = newOwner; } } function finishDistribution() onlyOwner canDistr public returns (bool) { distributionFinished = true; emit DistrFinished(); return true; } function distr(address _to, uint256 _amount) canDistr private returns (bool) { totalDistributed = totalDistributed.add(_amount); balances[_to] = balances[_to].add(_amount); emit Distr(_to, _amount); emit Transfer(address(0), _to, _amount); return true; } function doAirdrop(address _participant, uint _amount) internal { require( _amount > 0 ); require( totalDistributed < totalSupply ); balances[_participant] = balances[_participant].add(_amount); totalDistributed = totalDistributed.add(_amount); if (totalDistributed >= totalSupply) { distributionFinished = true; } emit Airdrop(_participant, _amount, balances[_participant]); emit Transfer(address(0), _participant, _amount); } function AirdropSingle(address _participant, uint _amount) public onlyOwner { doAirdrop(_participant, _amount); } function AirdropMultiple(address[] _addresses, uint _amount) public onlyOwner { for (uint i = 0; i < _addresses.length; i++) doAirdrop(_addresses[i], _amount); } function updateTokensPerEth(uint _tokensPerEth) public onlyOwner { tokensPerEth = _tokensPerEth; emit TokensPerEthUpdated(_tokensPerEth); } function () external payable { getTokens(); } function getTokens() payable canDistr public { uint256 tokens = 0; require( msg.value >= MIN ); require( msg.value > 0 ); tokens = tokensPerEth.mul(msg.value) / 1 ether; address investor = msg.sender; if (tokens > 0) { distr(investor, tokens); } if (totalDistributed >= totalSupply) { distributionFinished = true; } } modifier onlyPayloadSize(uint size) { assert(msg.data.length >= size + 4); _; } function balanceOf(address _owner) constant public returns (uint256) { return balances[_owner]; } function freeze(uint256 _value) returns (bool success) { if (balances[msg.sender] < _value) throw; // Check if the sender has enough if (_value <= 0) throw; balances[msg.sender] = SafeMath.sub(balances[msg.sender], _value); // Subtract from the sender freezeOf[msg.sender] = SafeMath.add(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.sub(freezeOf[msg.sender], _value); // Subtract from the sender balances[msg.sender] = SafeMath.add(balances[msg.sender], _value); Unfreeze(msg.sender, _value); return true; } function transfer(address _to, uint256 _amount) onlyPayloadSize(2 * 32) public returns (bool success) { //check if sender has balance and for oveflow require(_to != address(0)); require(_amount <= balances[msg.sender]); balances[msg.sender] = balances[msg.sender].sub(_amount); balances[_to] = balances[_to].add(_amount); emit Transfer(msg.sender, _to, _amount); return true; } function transferFrom(address _from, address _to, uint256 _amount) onlyPayloadSize(3 * 32) public returns (bool success) { require(_to != address(0)); require(_amount <= balances[_from]); require(_amount <= allowed[_from][msg.sender]); balances[_from] = balances[_from].sub(_amount); allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_amount); balances[_to] = balances[_to].add(_amount); emit Transfer(_from, _to, _amount); return true; } //allow the contract owner to withdraw any token that are not belongs to MillennialzApp Community function withdrawForeignTokens(address _tokenContract) onlyOwner public returns (bool) { ForeignToken token = ForeignToken(_tokenContract); uint256 amount = token.balanceOf(address(this)); return token.transfer(owner, amount); } //withdraw foreign tokens function approve(address _spender, uint256 _value) public returns (bool success) { if (_value != 0 && allowed[msg.sender][_spender] != 0) { return false; } allowed[msg.sender][_spender] = _value; emit Approval(msg.sender, _spender, _value); return true; } function getTokenBalance(address tokenAddress, address who) constant public returns (uint){ ForeignToken t = ForeignToken(tokenAddress); uint bal = t.balanceOf(who); return bal; } //withdraw Ethereum from Contract address function withdrawEther() onlyOwner public { address myAddress = this; uint256 etherBalance = myAddress.balance; owner.transfer(etherBalance); } function allowance(address _owner, address _spender) constant public returns (uint256) { return allowed[_owner][_spender]; } //Burning specific amount of MillennialzApp function burnMillennialzApp(uint256 _value) onlyOwner public { require(_value <= balances[msg.sender]); address burner = msg.sender; balances[burner] = balances[burner].sub(_value); totalSupply = totalSupply.sub(_value); totalDistributed = totalDistributed.sub(_value); emit Burn(burner, _value); } }
withdrawEther
function withdrawEther() onlyOwner public { address myAddress = this; uint256 etherBalance = myAddress.balance; owner.transfer(etherBalance); }
//withdraw Ethereum from Contract address
LineComment
v0.4.26+commit.4563c3fc
None
bzzr://7cefdadd8697c38652e1c0570d5dab038b71f33fc828aa549003efde88b43193
{ "func_code_index": [ 7197, 7377 ] }
1,054
MillennialzApp
MillennialzApp.sol
0xfa74500d028c25798ef6854380a81c7f07b26ea8
Solidity
MillennialzApp
contract MillennialzApp is ERC20 { using SafeMath for uint256; address owner = msg.sender; mapping (address => uint256) balances; mapping (address => mapping (address => uint256)) allowed; string public constant name = "MillennialzApp"; //* Token Name *// string public constant symbol = "MLZ"; //* MillennialzApp Symbol *// uint public constant decimals = 8; //* Number of Decimals *// uint256 public totalSupply = 100000000000000000; //* total supply of MillennialzApp *// uint256 public totalDistributed = 100000000; //* Initial MillennialzApp that will give to contract creator *// uint256 public constant MIN = 1 ether / 100; //* Minimum Contribution for MillennialzApp // uint256 public tokensPerEth = 558200000000; //* MillennialzApp Amount per Ethereum *// event Transfer(address indexed _from, address indexed _to, uint256 _value); event Approval(address indexed _owner, address indexed _spender, uint256 _value); event Distr(address indexed to, uint256 amount); event DistrFinished(); event Airdrop(address indexed _owner, uint _amount, uint _balance); event TokensPerEthUpdated(uint _tokensPerEth); event Burn(address indexed burner, uint256 value); event Freeze(address indexed from, uint256 value); //event freezing event Unfreeze(address indexed from, uint256 value); //event Unfreezing bool public distributionFinished = false; modifier canDistr() { require(!distributionFinished); _; } modifier onlyOwner() { require(msg.sender == owner); _; } function MillennialzApp () public { owner = msg.sender; distr(owner, totalDistributed); } function transferOwnership(address newOwner) onlyOwner public { if (newOwner != address(0)) { owner = newOwner; } } function finishDistribution() onlyOwner canDistr public returns (bool) { distributionFinished = true; emit DistrFinished(); return true; } function distr(address _to, uint256 _amount) canDistr private returns (bool) { totalDistributed = totalDistributed.add(_amount); balances[_to] = balances[_to].add(_amount); emit Distr(_to, _amount); emit Transfer(address(0), _to, _amount); return true; } function doAirdrop(address _participant, uint _amount) internal { require( _amount > 0 ); require( totalDistributed < totalSupply ); balances[_participant] = balances[_participant].add(_amount); totalDistributed = totalDistributed.add(_amount); if (totalDistributed >= totalSupply) { distributionFinished = true; } emit Airdrop(_participant, _amount, balances[_participant]); emit Transfer(address(0), _participant, _amount); } function AirdropSingle(address _participant, uint _amount) public onlyOwner { doAirdrop(_participant, _amount); } function AirdropMultiple(address[] _addresses, uint _amount) public onlyOwner { for (uint i = 0; i < _addresses.length; i++) doAirdrop(_addresses[i], _amount); } function updateTokensPerEth(uint _tokensPerEth) public onlyOwner { tokensPerEth = _tokensPerEth; emit TokensPerEthUpdated(_tokensPerEth); } function () external payable { getTokens(); } function getTokens() payable canDistr public { uint256 tokens = 0; require( msg.value >= MIN ); require( msg.value > 0 ); tokens = tokensPerEth.mul(msg.value) / 1 ether; address investor = msg.sender; if (tokens > 0) { distr(investor, tokens); } if (totalDistributed >= totalSupply) { distributionFinished = true; } } modifier onlyPayloadSize(uint size) { assert(msg.data.length >= size + 4); _; } function balanceOf(address _owner) constant public returns (uint256) { return balances[_owner]; } function freeze(uint256 _value) returns (bool success) { if (balances[msg.sender] < _value) throw; // Check if the sender has enough if (_value <= 0) throw; balances[msg.sender] = SafeMath.sub(balances[msg.sender], _value); // Subtract from the sender freezeOf[msg.sender] = SafeMath.add(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.sub(freezeOf[msg.sender], _value); // Subtract from the sender balances[msg.sender] = SafeMath.add(balances[msg.sender], _value); Unfreeze(msg.sender, _value); return true; } function transfer(address _to, uint256 _amount) onlyPayloadSize(2 * 32) public returns (bool success) { //check if sender has balance and for oveflow require(_to != address(0)); require(_amount <= balances[msg.sender]); balances[msg.sender] = balances[msg.sender].sub(_amount); balances[_to] = balances[_to].add(_amount); emit Transfer(msg.sender, _to, _amount); return true; } function transferFrom(address _from, address _to, uint256 _amount) onlyPayloadSize(3 * 32) public returns (bool success) { require(_to != address(0)); require(_amount <= balances[_from]); require(_amount <= allowed[_from][msg.sender]); balances[_from] = balances[_from].sub(_amount); allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_amount); balances[_to] = balances[_to].add(_amount); emit Transfer(_from, _to, _amount); return true; } //allow the contract owner to withdraw any token that are not belongs to MillennialzApp Community function withdrawForeignTokens(address _tokenContract) onlyOwner public returns (bool) { ForeignToken token = ForeignToken(_tokenContract); uint256 amount = token.balanceOf(address(this)); return token.transfer(owner, amount); } //withdraw foreign tokens function approve(address _spender, uint256 _value) public returns (bool success) { if (_value != 0 && allowed[msg.sender][_spender] != 0) { return false; } allowed[msg.sender][_spender] = _value; emit Approval(msg.sender, _spender, _value); return true; } function getTokenBalance(address tokenAddress, address who) constant public returns (uint){ ForeignToken t = ForeignToken(tokenAddress); uint bal = t.balanceOf(who); return bal; } //withdraw Ethereum from Contract address function withdrawEther() onlyOwner public { address myAddress = this; uint256 etherBalance = myAddress.balance; owner.transfer(etherBalance); } function allowance(address _owner, address _spender) constant public returns (uint256) { return allowed[_owner][_spender]; } //Burning specific amount of MillennialzApp function burnMillennialzApp(uint256 _value) onlyOwner public { require(_value <= balances[msg.sender]); address burner = msg.sender; balances[burner] = balances[burner].sub(_value); totalSupply = totalSupply.sub(_value); totalDistributed = totalDistributed.sub(_value); emit Burn(burner, _value); } }
burnMillennialzApp
function burnMillennialzApp(uint256 _value) onlyOwner public { require(_value <= balances[msg.sender]); address burner = msg.sender; balances[burner] = balances[burner].sub(_value); totalSupply = totalSupply.sub(_value); totalDistributed = totalDistributed.sub(_value); emit Burn(burner, _value); }
//Burning specific amount of MillennialzApp
LineComment
v0.4.26+commit.4563c3fc
None
bzzr://7cefdadd8697c38652e1c0570d5dab038b71f33fc828aa549003efde88b43193
{ "func_code_index": [ 7583, 7946 ] }
1,055
ZTToken
ZTToken.sol
0xb572d10b11b0c2951c8ef566d527f3cd8708d5a2
Solidity
Owned
contract Owned { // The address of the account that is the current owner address public owner; // The publiser is the inital owner function Owned() { owner = msg.sender; } /** * Access is restricted to the current owner */ modifier onlyOwner() { require(msg.sender == owner); _; } /** * Transfer ownership to `_newOwner` * * @param _newOwner The address of the account that will become the new owner */ function transferOwnership(address _newOwner) onlyOwner { owner = _newOwner; } }
Owned
function Owned() { owner = msg.sender; }
// The publiser is the inital owner
LineComment
v0.4.15+commit.bbb8e64f
bzzr://4c70c261386c94da493ad2c34bfd306629174754605eacfaeff94bfd0ee913eb
{ "func_code_index": [ 152, 211 ] }
1,056
ZTToken
ZTToken.sol
0xb572d10b11b0c2951c8ef566d527f3cd8708d5a2
Solidity
Owned
contract Owned { // The address of the account that is the current owner address public owner; // The publiser is the inital owner function Owned() { owner = msg.sender; } /** * Access is restricted to the current owner */ modifier onlyOwner() { require(msg.sender == owner); _; } /** * Transfer ownership to `_newOwner` * * @param _newOwner The address of the account that will become the new owner */ function transferOwnership(address _newOwner) onlyOwner { owner = _newOwner; } }
transferOwnership
function transferOwnership(address _newOwner) onlyOwner { owner = _newOwner; }
/** * Transfer ownership to `_newOwner` * * @param _newOwner The address of the account that will become the new owner */
NatSpecMultiLine
v0.4.15+commit.bbb8e64f
bzzr://4c70c261386c94da493ad2c34bfd306629174754605eacfaeff94bfd0ee913eb
{ "func_code_index": [ 522, 619 ] }
1,057
ZTToken
ZTToken.sol
0xb572d10b11b0c2951c8ef566d527f3cd8708d5a2
Solidity
Token
contract Token { /* This is a slight change to the ERC20 base standard. function totalSupply() constant returns (uint256 supply); is replaced with: uint256 public totalSupply; This automatically creates a getter function for the totalSupply. This is moved to the base contract since public getter functions are not currently recognised as an implementation of the matching abstract function by the compiler. */ /// total amount of tokens uint256 public totalSupply; /// @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 function transfer(address _to, uint256 _value) returns (bool success); /// @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 function transferFrom(address _from, address _to, uint256 _value) returns (bool success); /// @notice `msg.sender` approves `_spender` to spend `_value` tokens /// @param _spender The address of the account able to transfer the tokens /// @param _value The amount of tokens to be approved for transfer /// @return Whether the approval was successful or not function approve(address _spender, uint256 _value) returns (bool success); /// @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 function allowance(address _owner, address _spender) constant returns (uint256 remaining); event Transfer(address indexed _from, address indexed _to, uint256 _value); event Approval(address indexed _owner, address indexed _spender, uint256 _value); }
// Abstract contract for the full ERC 20 Token standard // https://github.com/ethereum/EIPs/issues/20
LineComment
balanceOf
function balanceOf(address _owner) constant returns (uint256 balance);
/// @param _owner The address from which the balance will be retrieved /// @return The balance
NatSpecSingleLine
v0.4.15+commit.bbb8e64f
bzzr://4c70c261386c94da493ad2c34bfd306629174754605eacfaeff94bfd0ee913eb
{ "func_code_index": [ 629, 704 ] }
1,058
ZTToken
ZTToken.sol
0xb572d10b11b0c2951c8ef566d527f3cd8708d5a2
Solidity
Token
contract Token { /* This is a slight change to the ERC20 base standard. function totalSupply() constant returns (uint256 supply); is replaced with: uint256 public totalSupply; This automatically creates a getter function for the totalSupply. This is moved to the base contract since public getter functions are not currently recognised as an implementation of the matching abstract function by the compiler. */ /// total amount of tokens uint256 public totalSupply; /// @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 function transfer(address _to, uint256 _value) returns (bool success); /// @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 function transferFrom(address _from, address _to, uint256 _value) returns (bool success); /// @notice `msg.sender` approves `_spender` to spend `_value` tokens /// @param _spender The address of the account able to transfer the tokens /// @param _value The amount of tokens to be approved for transfer /// @return Whether the approval was successful or not function approve(address _spender, uint256 _value) returns (bool success); /// @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 function allowance(address _owner, address _spender) constant returns (uint256 remaining); event Transfer(address indexed _from, address indexed _to, uint256 _value); event Approval(address indexed _owner, address indexed _spender, uint256 _value); }
// Abstract contract for the full ERC 20 Token standard // https://github.com/ethereum/EIPs/issues/20
LineComment
transfer
function transfer(address _to, uint256 _value) returns (bool success);
/// @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
NatSpecSingleLine
v0.4.15+commit.bbb8e64f
bzzr://4c70c261386c94da493ad2c34bfd306629174754605eacfaeff94bfd0ee913eb
{ "func_code_index": [ 941, 1016 ] }
1,059
ZTToken
ZTToken.sol
0xb572d10b11b0c2951c8ef566d527f3cd8708d5a2
Solidity
Token
contract Token { /* This is a slight change to the ERC20 base standard. function totalSupply() constant returns (uint256 supply); is replaced with: uint256 public totalSupply; This automatically creates a getter function for the totalSupply. This is moved to the base contract since public getter functions are not currently recognised as an implementation of the matching abstract function by the compiler. */ /// total amount of tokens uint256 public totalSupply; /// @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 function transfer(address _to, uint256 _value) returns (bool success); /// @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 function transferFrom(address _from, address _to, uint256 _value) returns (bool success); /// @notice `msg.sender` approves `_spender` to spend `_value` tokens /// @param _spender The address of the account able to transfer the tokens /// @param _value The amount of tokens to be approved for transfer /// @return Whether the approval was successful or not function approve(address _spender, uint256 _value) returns (bool success); /// @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 function allowance(address _owner, address _spender) constant returns (uint256 remaining); event Transfer(address indexed _from, address indexed _to, uint256 _value); event Approval(address indexed _owner, address indexed _spender, uint256 _value); }
// Abstract contract for the full ERC 20 Token standard // https://github.com/ethereum/EIPs/issues/20
LineComment
transferFrom
function transferFrom(address _from, address _to, uint256 _value) returns (bool success);
/// @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
NatSpecSingleLine
v0.4.15+commit.bbb8e64f
bzzr://4c70c261386c94da493ad2c34bfd306629174754605eacfaeff94bfd0ee913eb
{ "func_code_index": [ 1339, 1433 ] }
1,060
ZTToken
ZTToken.sol
0xb572d10b11b0c2951c8ef566d527f3cd8708d5a2
Solidity
Token
contract Token { /* This is a slight change to the ERC20 base standard. function totalSupply() constant returns (uint256 supply); is replaced with: uint256 public totalSupply; This automatically creates a getter function for the totalSupply. This is moved to the base contract since public getter functions are not currently recognised as an implementation of the matching abstract function by the compiler. */ /// total amount of tokens uint256 public totalSupply; /// @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 function transfer(address _to, uint256 _value) returns (bool success); /// @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 function transferFrom(address _from, address _to, uint256 _value) returns (bool success); /// @notice `msg.sender` approves `_spender` to spend `_value` tokens /// @param _spender The address of the account able to transfer the tokens /// @param _value The amount of tokens to be approved for transfer /// @return Whether the approval was successful or not function approve(address _spender, uint256 _value) returns (bool success); /// @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 function allowance(address _owner, address _spender) constant returns (uint256 remaining); event Transfer(address indexed _from, address indexed _to, uint256 _value); event Approval(address indexed _owner, address indexed _spender, uint256 _value); }
// Abstract contract for the full ERC 20 Token standard // https://github.com/ethereum/EIPs/issues/20
LineComment
approve
function approve(address _spender, uint256 _value) returns (bool success);
/// @notice `msg.sender` approves `_spender` to spend `_value` tokens /// @param _spender The address of the account able to transfer the tokens /// @param _value The amount of tokens to be approved for transfer /// @return Whether the approval was successful or not
NatSpecSingleLine
v0.4.15+commit.bbb8e64f
bzzr://4c70c261386c94da493ad2c34bfd306629174754605eacfaeff94bfd0ee913eb
{ "func_code_index": [ 1723, 1802 ] }
1,061
ZTToken
ZTToken.sol
0xb572d10b11b0c2951c8ef566d527f3cd8708d5a2
Solidity
Token
contract Token { /* This is a slight change to the ERC20 base standard. function totalSupply() constant returns (uint256 supply); is replaced with: uint256 public totalSupply; This automatically creates a getter function for the totalSupply. This is moved to the base contract since public getter functions are not currently recognised as an implementation of the matching abstract function by the compiler. */ /// total amount of tokens uint256 public totalSupply; /// @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 function transfer(address _to, uint256 _value) returns (bool success); /// @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 function transferFrom(address _from, address _to, uint256 _value) returns (bool success); /// @notice `msg.sender` approves `_spender` to spend `_value` tokens /// @param _spender The address of the account able to transfer the tokens /// @param _value The amount of tokens to be approved for transfer /// @return Whether the approval was successful or not function approve(address _spender, uint256 _value) returns (bool success); /// @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 function allowance(address _owner, address _spender) constant returns (uint256 remaining); event Transfer(address indexed _from, address indexed _to, uint256 _value); event Approval(address indexed _owner, address indexed _spender, uint256 _value); }
// Abstract contract for the full ERC 20 Token standard // https://github.com/ethereum/EIPs/issues/20
LineComment
allowance
function allowance(address _owner, address _spender) constant returns (uint256 remaining);
/// @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
NatSpecSingleLine
v0.4.15+commit.bbb8e64f
bzzr://4c70c261386c94da493ad2c34bfd306629174754605eacfaeff94bfd0ee913eb
{ "func_code_index": [ 2010, 2105 ] }
1,062
ZTToken
ZTToken.sol
0xb572d10b11b0c2951c8ef566d527f3cd8708d5a2
Solidity
StandardToken
contract StandardToken is Token { /** * ERC20 Short Address Attack fix */ modifier onlyPayloadSize(uint numArgs) { assert(msg.data.length == numArgs * 32 + 4); _; } // ZTT token balances mapping (address => uint256) balances; // ZTT token allowances mapping (address => mapping (address => uint256)) allowed; /** * Get balance of `_owner` * * @param _owner The address from which the balance will be retrieved * @return The balance */ function balanceOf(address _owner) constant returns (uint256 balance) { return balances[_owner]; } /** * 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 */ function transfer(address _to, uint256 _value) onlyPayloadSize(2) returns (bool success) { // Check if the sender has enough tokens require(balances[msg.sender] >= _value); // Check for overflows require(balances[_to] + _value > balances[_to]); // Transfer tokens balances[msg.sender] -= _value; balances[_to] += _value; // Notify listners Transfer(msg.sender, _to, _value); return true; } /** * 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 */ function transferFrom(address _from, address _to, uint256 _value) onlyPayloadSize(3) returns (bool success) { // Check if the sender has enough require(balances[_from] >= _value); // Check for overflows require(balances[_to] + _value > balances[_to]); // Check allowance require(_value <= allowed[_from][msg.sender]); // Transfer tokens balances[_to] += _value; balances[_from] -= _value; // Update allowance allowed[_from][msg.sender] -= _value; // Notify listners Transfer(_from, _to, _value); return true; } /** * `msg.sender` approves `_spender` to spend `_value` tokens * * @param _spender The address of the account able to transfer the tokens * @param _value The amount of tokens to be approved for transfer * @return Whether the approval was successful or not */ function approve(address _spender, uint256 _value) onlyPayloadSize(2) returns (bool success) { // Update allowance allowed[msg.sender][_spender] = _value; // Notify listners Approval(msg.sender, _spender, _value); return true; } /** * Get the amount of remaining tokens that `_spender` is allowed to spend from `_owner` * * @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 */ function allowance(address _owner, address _spender) constant returns (uint256 remaining) { return allowed[_owner][_spender]; } }
/** * Implements ERC 20 Token standard: https://github.com/ethereum/EIPs/issues/20 * * Modified version of https://github.com/ConsenSys/Tokens that implements the * original Token contract, an abstract contract for the full ERC 20 Token standard */
NatSpecMultiLine
balanceOf
function balanceOf(address _owner) constant returns (uint256 balance) { return balances[_owner]; }
/** * Get balance of `_owner` * * @param _owner The address from which the balance will be retrieved * @return The balance */
NatSpecMultiLine
v0.4.15+commit.bbb8e64f
bzzr://4c70c261386c94da493ad2c34bfd306629174754605eacfaeff94bfd0ee913eb
{ "func_code_index": [ 557, 674 ] }
1,063
ZTToken
ZTToken.sol
0xb572d10b11b0c2951c8ef566d527f3cd8708d5a2
Solidity
StandardToken
contract StandardToken is Token { /** * ERC20 Short Address Attack fix */ modifier onlyPayloadSize(uint numArgs) { assert(msg.data.length == numArgs * 32 + 4); _; } // ZTT token balances mapping (address => uint256) balances; // ZTT token allowances mapping (address => mapping (address => uint256)) allowed; /** * Get balance of `_owner` * * @param _owner The address from which the balance will be retrieved * @return The balance */ function balanceOf(address _owner) constant returns (uint256 balance) { return balances[_owner]; } /** * 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 */ function transfer(address _to, uint256 _value) onlyPayloadSize(2) returns (bool success) { // Check if the sender has enough tokens require(balances[msg.sender] >= _value); // Check for overflows require(balances[_to] + _value > balances[_to]); // Transfer tokens balances[msg.sender] -= _value; balances[_to] += _value; // Notify listners Transfer(msg.sender, _to, _value); return true; } /** * 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 */ function transferFrom(address _from, address _to, uint256 _value) onlyPayloadSize(3) returns (bool success) { // Check if the sender has enough require(balances[_from] >= _value); // Check for overflows require(balances[_to] + _value > balances[_to]); // Check allowance require(_value <= allowed[_from][msg.sender]); // Transfer tokens balances[_to] += _value; balances[_from] -= _value; // Update allowance allowed[_from][msg.sender] -= _value; // Notify listners Transfer(_from, _to, _value); return true; } /** * `msg.sender` approves `_spender` to spend `_value` tokens * * @param _spender The address of the account able to transfer the tokens * @param _value The amount of tokens to be approved for transfer * @return Whether the approval was successful or not */ function approve(address _spender, uint256 _value) onlyPayloadSize(2) returns (bool success) { // Update allowance allowed[msg.sender][_spender] = _value; // Notify listners Approval(msg.sender, _spender, _value); return true; } /** * Get the amount of remaining tokens that `_spender` is allowed to spend from `_owner` * * @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 */ function allowance(address _owner, address _spender) constant returns (uint256 remaining) { return allowed[_owner][_spender]; } }
/** * Implements ERC 20 Token standard: https://github.com/ethereum/EIPs/issues/20 * * Modified version of https://github.com/ConsenSys/Tokens that implements the * original Token contract, an abstract contract for the full ERC 20 Token standard */
NatSpecMultiLine
transfer
function transfer(address _to, uint256 _value) onlyPayloadSize(2) returns (bool success) { // Check if the sender has enough tokens require(balances[msg.sender] >= _value); // Check for overflows require(balances[_to] + _value > balances[_to]); // Transfer tokens balances[msg.sender] -= _value; balances[_to] += _value; // Notify listners Transfer(msg.sender, _to, _value); return true; }
/** * 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 */
NatSpecMultiLine
v0.4.15+commit.bbb8e64f
bzzr://4c70c261386c94da493ad2c34bfd306629174754605eacfaeff94bfd0ee913eb
{ "func_code_index": [ 929, 1429 ] }
1,064
ZTToken
ZTToken.sol
0xb572d10b11b0c2951c8ef566d527f3cd8708d5a2
Solidity
StandardToken
contract StandardToken is Token { /** * ERC20 Short Address Attack fix */ modifier onlyPayloadSize(uint numArgs) { assert(msg.data.length == numArgs * 32 + 4); _; } // ZTT token balances mapping (address => uint256) balances; // ZTT token allowances mapping (address => mapping (address => uint256)) allowed; /** * Get balance of `_owner` * * @param _owner The address from which the balance will be retrieved * @return The balance */ function balanceOf(address _owner) constant returns (uint256 balance) { return balances[_owner]; } /** * 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 */ function transfer(address _to, uint256 _value) onlyPayloadSize(2) returns (bool success) { // Check if the sender has enough tokens require(balances[msg.sender] >= _value); // Check for overflows require(balances[_to] + _value > balances[_to]); // Transfer tokens balances[msg.sender] -= _value; balances[_to] += _value; // Notify listners Transfer(msg.sender, _to, _value); return true; } /** * 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 */ function transferFrom(address _from, address _to, uint256 _value) onlyPayloadSize(3) returns (bool success) { // Check if the sender has enough require(balances[_from] >= _value); // Check for overflows require(balances[_to] + _value > balances[_to]); // Check allowance require(_value <= allowed[_from][msg.sender]); // Transfer tokens balances[_to] += _value; balances[_from] -= _value; // Update allowance allowed[_from][msg.sender] -= _value; // Notify listners Transfer(_from, _to, _value); return true; } /** * `msg.sender` approves `_spender` to spend `_value` tokens * * @param _spender The address of the account able to transfer the tokens * @param _value The amount of tokens to be approved for transfer * @return Whether the approval was successful or not */ function approve(address _spender, uint256 _value) onlyPayloadSize(2) returns (bool success) { // Update allowance allowed[msg.sender][_spender] = _value; // Notify listners Approval(msg.sender, _spender, _value); return true; } /** * Get the amount of remaining tokens that `_spender` is allowed to spend from `_owner` * * @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 */ function allowance(address _owner, address _spender) constant returns (uint256 remaining) { return allowed[_owner][_spender]; } }
/** * Implements ERC 20 Token standard: https://github.com/ethereum/EIPs/issues/20 * * Modified version of https://github.com/ConsenSys/Tokens that implements the * original Token contract, an abstract contract for the full ERC 20 Token standard */
NatSpecMultiLine
transferFrom
function transferFrom(address _from, address _to, uint256 _value) onlyPayloadSize(3) returns (bool success) { // Check if the sender has enough require(balances[_from] >= _value); // Check for overflows require(balances[_to] + _value > balances[_to]); // Check allowance require(_value <= allowed[_from][msg.sender]); // Transfer tokens balances[_to] += _value; balances[_from] -= _value; // Update allowance allowed[_from][msg.sender] -= _value; // Notify listners Transfer(_from, _to, _value); return true; }
/** * 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 */
NatSpecMultiLine
v0.4.15+commit.bbb8e64f
bzzr://4c70c261386c94da493ad2c34bfd306629174754605eacfaeff94bfd0ee913eb
{ "func_code_index": [ 1769, 2427 ] }
1,065
ZTToken
ZTToken.sol
0xb572d10b11b0c2951c8ef566d527f3cd8708d5a2
Solidity
StandardToken
contract StandardToken is Token { /** * ERC20 Short Address Attack fix */ modifier onlyPayloadSize(uint numArgs) { assert(msg.data.length == numArgs * 32 + 4); _; } // ZTT token balances mapping (address => uint256) balances; // ZTT token allowances mapping (address => mapping (address => uint256)) allowed; /** * Get balance of `_owner` * * @param _owner The address from which the balance will be retrieved * @return The balance */ function balanceOf(address _owner) constant returns (uint256 balance) { return balances[_owner]; } /** * 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 */ function transfer(address _to, uint256 _value) onlyPayloadSize(2) returns (bool success) { // Check if the sender has enough tokens require(balances[msg.sender] >= _value); // Check for overflows require(balances[_to] + _value > balances[_to]); // Transfer tokens balances[msg.sender] -= _value; balances[_to] += _value; // Notify listners Transfer(msg.sender, _to, _value); return true; } /** * 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 */ function transferFrom(address _from, address _to, uint256 _value) onlyPayloadSize(3) returns (bool success) { // Check if the sender has enough require(balances[_from] >= _value); // Check for overflows require(balances[_to] + _value > balances[_to]); // Check allowance require(_value <= allowed[_from][msg.sender]); // Transfer tokens balances[_to] += _value; balances[_from] -= _value; // Update allowance allowed[_from][msg.sender] -= _value; // Notify listners Transfer(_from, _to, _value); return true; } /** * `msg.sender` approves `_spender` to spend `_value` tokens * * @param _spender The address of the account able to transfer the tokens * @param _value The amount of tokens to be approved for transfer * @return Whether the approval was successful or not */ function approve(address _spender, uint256 _value) onlyPayloadSize(2) returns (bool success) { // Update allowance allowed[msg.sender][_spender] = _value; // Notify listners Approval(msg.sender, _spender, _value); return true; } /** * Get the amount of remaining tokens that `_spender` is allowed to spend from `_owner` * * @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 */ function allowance(address _owner, address _spender) constant returns (uint256 remaining) { return allowed[_owner][_spender]; } }
/** * Implements ERC 20 Token standard: https://github.com/ethereum/EIPs/issues/20 * * Modified version of https://github.com/ConsenSys/Tokens that implements the * original Token contract, an abstract contract for the full ERC 20 Token standard */
NatSpecMultiLine
approve
function approve(address _spender, uint256 _value) onlyPayloadSize(2) returns (bool success) { // Update allowance allowed[msg.sender][_spender] = _value; // Notify listners Approval(msg.sender, _spender, _value); return true; }
/** * `msg.sender` approves `_spender` to spend `_value` tokens * * @param _spender The address of the account able to transfer the tokens * @param _value The amount of tokens to be approved for transfer * @return Whether the approval was successful or not */
NatSpecMultiLine
v0.4.15+commit.bbb8e64f
bzzr://4c70c261386c94da493ad2c34bfd306629174754605eacfaeff94bfd0ee913eb
{ "func_code_index": [ 2735, 3022 ] }
1,066
ZTToken
ZTToken.sol
0xb572d10b11b0c2951c8ef566d527f3cd8708d5a2
Solidity
StandardToken
contract StandardToken is Token { /** * ERC20 Short Address Attack fix */ modifier onlyPayloadSize(uint numArgs) { assert(msg.data.length == numArgs * 32 + 4); _; } // ZTT token balances mapping (address => uint256) balances; // ZTT token allowances mapping (address => mapping (address => uint256)) allowed; /** * Get balance of `_owner` * * @param _owner The address from which the balance will be retrieved * @return The balance */ function balanceOf(address _owner) constant returns (uint256 balance) { return balances[_owner]; } /** * 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 */ function transfer(address _to, uint256 _value) onlyPayloadSize(2) returns (bool success) { // Check if the sender has enough tokens require(balances[msg.sender] >= _value); // Check for overflows require(balances[_to] + _value > balances[_to]); // Transfer tokens balances[msg.sender] -= _value; balances[_to] += _value; // Notify listners Transfer(msg.sender, _to, _value); return true; } /** * 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 */ function transferFrom(address _from, address _to, uint256 _value) onlyPayloadSize(3) returns (bool success) { // Check if the sender has enough require(balances[_from] >= _value); // Check for overflows require(balances[_to] + _value > balances[_to]); // Check allowance require(_value <= allowed[_from][msg.sender]); // Transfer tokens balances[_to] += _value; balances[_from] -= _value; // Update allowance allowed[_from][msg.sender] -= _value; // Notify listners Transfer(_from, _to, _value); return true; } /** * `msg.sender` approves `_spender` to spend `_value` tokens * * @param _spender The address of the account able to transfer the tokens * @param _value The amount of tokens to be approved for transfer * @return Whether the approval was successful or not */ function approve(address _spender, uint256 _value) onlyPayloadSize(2) returns (bool success) { // Update allowance allowed[msg.sender][_spender] = _value; // Notify listners Approval(msg.sender, _spender, _value); return true; } /** * Get the amount of remaining tokens that `_spender` is allowed to spend from `_owner` * * @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 */ function allowance(address _owner, address _spender) constant returns (uint256 remaining) { return allowed[_owner][_spender]; } }
/** * Implements ERC 20 Token standard: https://github.com/ethereum/EIPs/issues/20 * * Modified version of https://github.com/ConsenSys/Tokens that implements the * original Token contract, an abstract contract for the full ERC 20 Token standard */
NatSpecMultiLine
allowance
function allowance(address _owner, address _spender) constant returns (uint256 remaining) { return allowed[_owner][_spender]; }
/** * Get the amount of remaining tokens that `_spender` is allowed to spend from `_owner` * * @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 */
NatSpecMultiLine
v0.4.15+commit.bbb8e64f
bzzr://4c70c261386c94da493ad2c34bfd306629174754605eacfaeff94bfd0ee913eb
{ "func_code_index": [ 3350, 3494 ] }
1,067
ZTToken
ZTToken.sol
0xb572d10b11b0c2951c8ef566d527f3cd8708d5a2
Solidity
ZTToken
contract ZTToken is Owned, StandardToken { // Ethereum token standard string public standard = "Token 0.2"; // Full name string public name = "ZeroTraffic"; // Symbol string public symbol = "ZTT"; // No decimal points uint8 public decimals = 8; // Core team insentive distribution bool public incentiveDistributed = false; uint256 public incentiveDistributionDate = 0; uint256 public incentiveDistributionInterval = 2 years; // Core team incentives struct Incentive { address recipient; uint8 percentage; } Incentive[] public incentives; /** * Starts with a total supply of zero and the creator starts with * zero tokens (just like everyone else) */ function ZTToken() { balances[msg.sender] = 0; totalSupply = 0; incentiveDistributionDate = now + incentiveDistributionInterval; incentives.push(Incentive(0x3cAf983aCCccc2551195e0809B7824DA6FDe4EC8, 1)); // 0.01 * 10^2 Frank Bonnet } /** * Distributes incentives over the core team members as * described in the whitepaper */ function withdrawIncentives() { require(!incentiveDistributed); require(now > incentiveDistributionDate); incentiveDistributed = true; uint256 totalSupplyToDate = totalSupply; for (uint256 i = 0; i < incentives.length; i++) { // totalSupplyToDate * (percentage * 10^2) / 10^2 / denominator uint256 amount = totalSupplyToDate * incentives[i].percentage / 10**2; address recipient = incentives[i].recipient; // Create tokens balances[recipient] += amount; totalSupply += amount; // Notify listners Transfer(0, this, amount); Transfer(this, recipient, amount); } } /** * Issues `_value` new tokens to `_recipient` (_value < 0 guarantees that tokens are never removed) * * @param _recipient The address to which the tokens will be issued * @param _value The amount of new tokens to issue * @return Whether the approval was successful or not */ function issue(address _recipient, uint256 _value) onlyOwner onlyPayloadSize(2) returns (bool success) { // Guarantee positive require(_value > 0); // Create tokens balances[_recipient] += _value; totalSupply += _value; // Notify listners Transfer(0, owner, _value); Transfer(owner, _recipient, _value); return true; } /** * Prevents accidental sending of ether */ function () { revert(); } }
/** * @title ZTT (ZeroTraffic) token * * Implements ERC 20 Token standard: https://github.com/ethereum/EIPs/issues/20 with the addition * of ownership, a lock and issuing. * * #created 29/08/2017 * #author Frank Bonnet */
NatSpecMultiLine
ZTToken
function ZTToken() { balances[msg.sender] = 0; totalSupply = 0; incentiveDistributionDate = now + incentiveDistributionInterval; incentives.push(Incentive(0x3cAf983aCCccc2551195e0809B7824DA6FDe4EC8, 1)); // 0.01 * 10^2 Frank Bonnet }
/** * Starts with a total supply of zero and the creator starts with * zero tokens (just like everyone else) */
NatSpecMultiLine
v0.4.15+commit.bbb8e64f
bzzr://4c70c261386c94da493ad2c34bfd306629174754605eacfaeff94bfd0ee913eb
{ "func_code_index": [ 811, 1092 ] }
1,068
ZTToken
ZTToken.sol
0xb572d10b11b0c2951c8ef566d527f3cd8708d5a2
Solidity
ZTToken
contract ZTToken is Owned, StandardToken { // Ethereum token standard string public standard = "Token 0.2"; // Full name string public name = "ZeroTraffic"; // Symbol string public symbol = "ZTT"; // No decimal points uint8 public decimals = 8; // Core team insentive distribution bool public incentiveDistributed = false; uint256 public incentiveDistributionDate = 0; uint256 public incentiveDistributionInterval = 2 years; // Core team incentives struct Incentive { address recipient; uint8 percentage; } Incentive[] public incentives; /** * Starts with a total supply of zero and the creator starts with * zero tokens (just like everyone else) */ function ZTToken() { balances[msg.sender] = 0; totalSupply = 0; incentiveDistributionDate = now + incentiveDistributionInterval; incentives.push(Incentive(0x3cAf983aCCccc2551195e0809B7824DA6FDe4EC8, 1)); // 0.01 * 10^2 Frank Bonnet } /** * Distributes incentives over the core team members as * described in the whitepaper */ function withdrawIncentives() { require(!incentiveDistributed); require(now > incentiveDistributionDate); incentiveDistributed = true; uint256 totalSupplyToDate = totalSupply; for (uint256 i = 0; i < incentives.length; i++) { // totalSupplyToDate * (percentage * 10^2) / 10^2 / denominator uint256 amount = totalSupplyToDate * incentives[i].percentage / 10**2; address recipient = incentives[i].recipient; // Create tokens balances[recipient] += amount; totalSupply += amount; // Notify listners Transfer(0, this, amount); Transfer(this, recipient, amount); } } /** * Issues `_value` new tokens to `_recipient` (_value < 0 guarantees that tokens are never removed) * * @param _recipient The address to which the tokens will be issued * @param _value The amount of new tokens to issue * @return Whether the approval was successful or not */ function issue(address _recipient, uint256 _value) onlyOwner onlyPayloadSize(2) returns (bool success) { // Guarantee positive require(_value > 0); // Create tokens balances[_recipient] += _value; totalSupply += _value; // Notify listners Transfer(0, owner, _value); Transfer(owner, _recipient, _value); return true; } /** * Prevents accidental sending of ether */ function () { revert(); } }
/** * @title ZTT (ZeroTraffic) token * * Implements ERC 20 Token standard: https://github.com/ethereum/EIPs/issues/20 with the addition * of ownership, a lock and issuing. * * #created 29/08/2017 * #author Frank Bonnet */
NatSpecMultiLine
withdrawIncentives
function withdrawIncentives() { require(!incentiveDistributed); require(now > incentiveDistributionDate); incentiveDistributed = true; uint256 totalSupplyToDate = totalSupply; for (uint256 i = 0; i < incentives.length; i++) { // totalSupplyToDate * (percentage * 10^2) / 10^2 / denominator uint256 amount = totalSupplyToDate * incentives[i].percentage / 10**2; address recipient = incentives[i].recipient; // Create tokens balances[recipient] += amount; totalSupply += amount; // Notify listners Transfer(0, this, amount); Transfer(this, recipient, amount); } }
/** * Distributes incentives over the core team members as * described in the whitepaper */
NatSpecMultiLine
v0.4.15+commit.bbb8e64f
bzzr://4c70c261386c94da493ad2c34bfd306629174754605eacfaeff94bfd0ee913eb
{ "func_code_index": [ 1213, 1966 ] }
1,069
ZTToken
ZTToken.sol
0xb572d10b11b0c2951c8ef566d527f3cd8708d5a2
Solidity
ZTToken
contract ZTToken is Owned, StandardToken { // Ethereum token standard string public standard = "Token 0.2"; // Full name string public name = "ZeroTraffic"; // Symbol string public symbol = "ZTT"; // No decimal points uint8 public decimals = 8; // Core team insentive distribution bool public incentiveDistributed = false; uint256 public incentiveDistributionDate = 0; uint256 public incentiveDistributionInterval = 2 years; // Core team incentives struct Incentive { address recipient; uint8 percentage; } Incentive[] public incentives; /** * Starts with a total supply of zero and the creator starts with * zero tokens (just like everyone else) */ function ZTToken() { balances[msg.sender] = 0; totalSupply = 0; incentiveDistributionDate = now + incentiveDistributionInterval; incentives.push(Incentive(0x3cAf983aCCccc2551195e0809B7824DA6FDe4EC8, 1)); // 0.01 * 10^2 Frank Bonnet } /** * Distributes incentives over the core team members as * described in the whitepaper */ function withdrawIncentives() { require(!incentiveDistributed); require(now > incentiveDistributionDate); incentiveDistributed = true; uint256 totalSupplyToDate = totalSupply; for (uint256 i = 0; i < incentives.length; i++) { // totalSupplyToDate * (percentage * 10^2) / 10^2 / denominator uint256 amount = totalSupplyToDate * incentives[i].percentage / 10**2; address recipient = incentives[i].recipient; // Create tokens balances[recipient] += amount; totalSupply += amount; // Notify listners Transfer(0, this, amount); Transfer(this, recipient, amount); } } /** * Issues `_value` new tokens to `_recipient` (_value < 0 guarantees that tokens are never removed) * * @param _recipient The address to which the tokens will be issued * @param _value The amount of new tokens to issue * @return Whether the approval was successful or not */ function issue(address _recipient, uint256 _value) onlyOwner onlyPayloadSize(2) returns (bool success) { // Guarantee positive require(_value > 0); // Create tokens balances[_recipient] += _value; totalSupply += _value; // Notify listners Transfer(0, owner, _value); Transfer(owner, _recipient, _value); return true; } /** * Prevents accidental sending of ether */ function () { revert(); } }
/** * @title ZTT (ZeroTraffic) token * * Implements ERC 20 Token standard: https://github.com/ethereum/EIPs/issues/20 with the addition * of ownership, a lock and issuing. * * #created 29/08/2017 * #author Frank Bonnet */
NatSpecMultiLine
issue
function issue(address _recipient, uint256 _value) onlyOwner onlyPayloadSize(2) returns (bool success) { // Guarantee positive require(_value > 0); // Create tokens balances[_recipient] += _value; totalSupply += _value; // Notify listners Transfer(0, owner, _value); Transfer(owner, _recipient, _value); return true; }
/** * Issues `_value` new tokens to `_recipient` (_value < 0 guarantees that tokens are never removed) * * @param _recipient The address to which the tokens will be issued * @param _value The amount of new tokens to issue * @return Whether the approval was successful or not */
NatSpecMultiLine
v0.4.15+commit.bbb8e64f
bzzr://4c70c261386c94da493ad2c34bfd306629174754605eacfaeff94bfd0ee913eb
{ "func_code_index": [ 2290, 2709 ] }
1,070
ZTToken
ZTToken.sol
0xb572d10b11b0c2951c8ef566d527f3cd8708d5a2
Solidity
ZTToken
contract ZTToken is Owned, StandardToken { // Ethereum token standard string public standard = "Token 0.2"; // Full name string public name = "ZeroTraffic"; // Symbol string public symbol = "ZTT"; // No decimal points uint8 public decimals = 8; // Core team insentive distribution bool public incentiveDistributed = false; uint256 public incentiveDistributionDate = 0; uint256 public incentiveDistributionInterval = 2 years; // Core team incentives struct Incentive { address recipient; uint8 percentage; } Incentive[] public incentives; /** * Starts with a total supply of zero and the creator starts with * zero tokens (just like everyone else) */ function ZTToken() { balances[msg.sender] = 0; totalSupply = 0; incentiveDistributionDate = now + incentiveDistributionInterval; incentives.push(Incentive(0x3cAf983aCCccc2551195e0809B7824DA6FDe4EC8, 1)); // 0.01 * 10^2 Frank Bonnet } /** * Distributes incentives over the core team members as * described in the whitepaper */ function withdrawIncentives() { require(!incentiveDistributed); require(now > incentiveDistributionDate); incentiveDistributed = true; uint256 totalSupplyToDate = totalSupply; for (uint256 i = 0; i < incentives.length; i++) { // totalSupplyToDate * (percentage * 10^2) / 10^2 / denominator uint256 amount = totalSupplyToDate * incentives[i].percentage / 10**2; address recipient = incentives[i].recipient; // Create tokens balances[recipient] += amount; totalSupply += amount; // Notify listners Transfer(0, this, amount); Transfer(this, recipient, amount); } } /** * Issues `_value` new tokens to `_recipient` (_value < 0 guarantees that tokens are never removed) * * @param _recipient The address to which the tokens will be issued * @param _value The amount of new tokens to issue * @return Whether the approval was successful or not */ function issue(address _recipient, uint256 _value) onlyOwner onlyPayloadSize(2) returns (bool success) { // Guarantee positive require(_value > 0); // Create tokens balances[_recipient] += _value; totalSupply += _value; // Notify listners Transfer(0, owner, _value); Transfer(owner, _recipient, _value); return true; } /** * Prevents accidental sending of ether */ function () { revert(); } }
/** * @title ZTT (ZeroTraffic) token * * Implements ERC 20 Token standard: https://github.com/ethereum/EIPs/issues/20 with the addition * of ownership, a lock and issuing. * * #created 29/08/2017 * #author Frank Bonnet */
NatSpecMultiLine
function () { revert(); }
/** * Prevents accidental sending of ether */
NatSpecMultiLine
v0.4.15+commit.bbb8e64f
bzzr://4c70c261386c94da493ad2c34bfd306629174754605eacfaeff94bfd0ee913eb
{ "func_code_index": [ 2777, 2821 ] }
1,071
VotingPower
contracts/lib/PrismProxyImplementation.sol
0xd07d77eab98f32f672de1f5b6a6aa824582e74cd
Solidity
PrismProxyImplementation
contract PrismProxyImplementation is Initializable { /** * @notice Accept invitation to be implementation contract for proxy * @param prism Prism Proxy contract */ function become(PrismProxy prism) public { require(msg.sender == prism.proxyAdmin(), "Prism::become: only proxy admin can change implementation"); require(prism.acceptProxyImplementation() == true, "Prism::become: change not authorized"); } }
become
function become(PrismProxy prism) public { require(msg.sender == prism.proxyAdmin(), "Prism::become: only proxy admin can change implementation"); require(prism.acceptProxyImplementation() == true, "Prism::become: change not authorized"); }
/** * @notice Accept invitation to be implementation contract for proxy * @param prism Prism Proxy contract */
NatSpecMultiLine
v0.7.4+commit.3f05b770
MIT
{ "func_code_index": [ 183, 447 ] }
1,072
Yearnifyfinance
Yearnifyfinance.sol
0xb9ae6fe574982e891666a5b1c2b33e79eb5dabb5
Solidity
StandardToken
contract StandardToken is ERC20{ using SafeMath for uint256; mapping(address => uint256) balances; mapping (address => mapping (address => uint256)) allowed; function _transfer(address _from, address _to, uint256 _value) internal returns (bool success){ //prevent sending of tokens from genesis address or to self require(_from != address(0) && _from != _to); require(_to != address(0)); //subtract tokens from the sender on transfer balances[_from] = balances[_from].safeSub(_value); //add tokens to the receiver on reception balances[_to] = balances[_to].safeAdd(_value); return true; } function transfer(address _to, uint256 _value) public returns (bool success) { require(_value <= balances[msg.sender]); _transfer(msg.sender,_to,_value); emit Transfer(msg.sender, _to, _value); return true; } function transferFrom(address _from, address _to, uint256 _value) public returns (bool) { uint256 _allowance = allowed[_from][msg.sender]; //value must be less than allowed value require(_value <= _allowance); //balance of sender + token value transferred by sender must be greater than balance of sender require(balances[_to] + _value > balances[_to]); //call transfer function _transfer(_from,_to,_value); //subtract the amount allowed to the sender allowed[_from][msg.sender] = _allowance.safeSub(_value); //trigger Transfer event emit Transfer(_from, _to, _value); return true; } function balanceOf(address _owner) public constant returns (uint balance) { return balances[_owner]; } /** * @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) { // To change the approve amount you first have to reduce the addresses` // allowance to zero by calling `approve(_spender,0)` if it is not // already 0 to mitigate the race condition described here: // https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 require((_value == 0) || (allowed[msg.sender][_spender] == 0)); allowed[msg.sender][_spender] = _value; emit Approval(msg.sender, _spender, _value); return true; } /** * @dev Function to check the amount of tokens that an owner allowed to a spender. * @param _owner address The address which owns the funds. * @param _spender address The address which will spend the funds. * @return A uint256 specifying the amount of tokens still available for the spender. */ function allowance(address _owner, address _spender) public view returns (uint256) { return allowed[_owner][_spender]; } }
approve
function approve(address _spender, uint256 _value) public returns (bool) { // To change the approve amount you first have to reduce the addresses` // allowance to zero by calling `approve(_spender,0)` if it is not // already 0 to mitigate the race condition described here: // https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 require((_value == 0) || (allowed[msg.sender][_spender] == 0)); allowed[msg.sender][_spender] = _value; emit Approval(msg.sender, _spender, _value); return true; }
/** * @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender. * * Beware that changing an allowance with this method brings the risk that someone may use both the old * and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this * race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * @param _spender The address which will spend the funds. * @param _value The amount of tokens to be spent. */
NatSpecMultiLine
v0.4.25+commit.59dbf8f1
None
bzzr://b9787d9ba7da01ddf2575796a9d6067ca256881369a10e34ccbb62a50eb9ac6b
{ "func_code_index": [ 2367, 2922 ] }
1,073
Yearnifyfinance
Yearnifyfinance.sol
0xb9ae6fe574982e891666a5b1c2b33e79eb5dabb5
Solidity
StandardToken
contract StandardToken is ERC20{ using SafeMath for uint256; mapping(address => uint256) balances; mapping (address => mapping (address => uint256)) allowed; function _transfer(address _from, address _to, uint256 _value) internal returns (bool success){ //prevent sending of tokens from genesis address or to self require(_from != address(0) && _from != _to); require(_to != address(0)); //subtract tokens from the sender on transfer balances[_from] = balances[_from].safeSub(_value); //add tokens to the receiver on reception balances[_to] = balances[_to].safeAdd(_value); return true; } function transfer(address _to, uint256 _value) public returns (bool success) { require(_value <= balances[msg.sender]); _transfer(msg.sender,_to,_value); emit Transfer(msg.sender, _to, _value); return true; } function transferFrom(address _from, address _to, uint256 _value) public returns (bool) { uint256 _allowance = allowed[_from][msg.sender]; //value must be less than allowed value require(_value <= _allowance); //balance of sender + token value transferred by sender must be greater than balance of sender require(balances[_to] + _value > balances[_to]); //call transfer function _transfer(_from,_to,_value); //subtract the amount allowed to the sender allowed[_from][msg.sender] = _allowance.safeSub(_value); //trigger Transfer event emit Transfer(_from, _to, _value); return true; } function balanceOf(address _owner) public constant returns (uint balance) { return balances[_owner]; } /** * @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) { // To change the approve amount you first have to reduce the addresses` // allowance to zero by calling `approve(_spender,0)` if it is not // already 0 to mitigate the race condition described here: // https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 require((_value == 0) || (allowed[msg.sender][_spender] == 0)); allowed[msg.sender][_spender] = _value; emit Approval(msg.sender, _spender, _value); return true; } /** * @dev Function to check the amount of tokens that an owner allowed to a spender. * @param _owner address The address which owns the funds. * @param _spender address The address which will spend the funds. * @return A uint256 specifying the amount of tokens still available for the spender. */ function allowance(address _owner, address _spender) public view returns (uint256) { return allowed[_owner][_spender]; } }
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.25+commit.59dbf8f1
None
bzzr://b9787d9ba7da01ddf2575796a9d6067ca256881369a10e34ccbb62a50eb9ac6b
{ "func_code_index": [ 3246, 3377 ] }
1,074
Yearnifyfinance
Yearnifyfinance.sol
0xb9ae6fe574982e891666a5b1c2b33e79eb5dabb5
Solidity
Yearnifyfinance
contract Yearnifyfinance is StandardToken, OnlyOwner{ uint256 public constant decimals = 18; string public constant name = "Yearnify"; string public constant symbol = "YFY"; string public constant version = "1.0"; uint256 public constant totalSupply =29000*10**18; uint256 private approvalCounts =0; uint256 private minRequiredApprovals =2; address public burnedTokensReceiver; constructor() public{ balances[msg.sender] = totalSupply; burnedTokensReceiver = 0x0000000000000000000000000000000000000000; } /** * @dev Function to set approval count variable value. * @param _value uint The value by which approvalCounts variable will be set. */ function setApprovalCounts(uint _value) public isController { approvalCounts = _value; } /** * @dev Function to set minimum require approval variable value. * @param _value uint The value by which minRequiredApprovals variable will be set. * @return true. */ function setMinApprovalCounts(uint _value) public isController returns (bool){ require(_value > 0); minRequiredApprovals = _value; return true; } /** * @dev Function to get approvalCounts variable value. * @return approvalCounts. */ function getApprovalCount() public view isController returns(uint){ return approvalCounts; } /** * @dev Function to get burned Tokens Receiver address. * @return burnedTokensReceiver. */ function getBurnedTokensReceiver() public view isController returns(address){ return burnedTokensReceiver; } function controllerApproval(address _from, uint256 _value) public isOwner returns (bool) { require(minRequiredApprovals <= approvalCounts); require(_value <= balances[_from]); balances[_from] = balances[_from].safeSub(_value); balances[burnedTokensReceiver] = balances[burnedTokensReceiver].safeAdd(_value); emit Transfer(_from,burnedTokensReceiver, _value); return true; } }
setApprovalCounts
function setApprovalCounts(uint _value) public isController { approvalCounts = _value; }
/** * @dev Function to set approval count variable value. * @param _value uint The value by which approvalCounts variable will be set. */
NatSpecMultiLine
v0.4.25+commit.59dbf8f1
None
bzzr://b9787d9ba7da01ddf2575796a9d6067ca256881369a10e34ccbb62a50eb9ac6b
{ "func_code_index": [ 734, 841 ] }
1,075
Yearnifyfinance
Yearnifyfinance.sol
0xb9ae6fe574982e891666a5b1c2b33e79eb5dabb5
Solidity
Yearnifyfinance
contract Yearnifyfinance is StandardToken, OnlyOwner{ uint256 public constant decimals = 18; string public constant name = "Yearnify"; string public constant symbol = "YFY"; string public constant version = "1.0"; uint256 public constant totalSupply =29000*10**18; uint256 private approvalCounts =0; uint256 private minRequiredApprovals =2; address public burnedTokensReceiver; constructor() public{ balances[msg.sender] = totalSupply; burnedTokensReceiver = 0x0000000000000000000000000000000000000000; } /** * @dev Function to set approval count variable value. * @param _value uint The value by which approvalCounts variable will be set. */ function setApprovalCounts(uint _value) public isController { approvalCounts = _value; } /** * @dev Function to set minimum require approval variable value. * @param _value uint The value by which minRequiredApprovals variable will be set. * @return true. */ function setMinApprovalCounts(uint _value) public isController returns (bool){ require(_value > 0); minRequiredApprovals = _value; return true; } /** * @dev Function to get approvalCounts variable value. * @return approvalCounts. */ function getApprovalCount() public view isController returns(uint){ return approvalCounts; } /** * @dev Function to get burned Tokens Receiver address. * @return burnedTokensReceiver. */ function getBurnedTokensReceiver() public view isController returns(address){ return burnedTokensReceiver; } function controllerApproval(address _from, uint256 _value) public isOwner returns (bool) { require(minRequiredApprovals <= approvalCounts); require(_value <= balances[_from]); balances[_from] = balances[_from].safeSub(_value); balances[burnedTokensReceiver] = balances[burnedTokensReceiver].safeAdd(_value); emit Transfer(_from,burnedTokensReceiver, _value); return true; } }
setMinApprovalCounts
function setMinApprovalCounts(uint _value) public isController returns (bool){ require(_value > 0); minRequiredApprovals = _value; return true; }
/** * @dev Function to set minimum require approval variable value. * @param _value uint The value by which minRequiredApprovals variable will be set. * @return true. */
NatSpecMultiLine
v0.4.25+commit.59dbf8f1
None
bzzr://b9787d9ba7da01ddf2575796a9d6067ca256881369a10e34ccbb62a50eb9ac6b
{ "func_code_index": [ 1039, 1221 ] }
1,076
Yearnifyfinance
Yearnifyfinance.sol
0xb9ae6fe574982e891666a5b1c2b33e79eb5dabb5
Solidity
Yearnifyfinance
contract Yearnifyfinance is StandardToken, OnlyOwner{ uint256 public constant decimals = 18; string public constant name = "Yearnify"; string public constant symbol = "YFY"; string public constant version = "1.0"; uint256 public constant totalSupply =29000*10**18; uint256 private approvalCounts =0; uint256 private minRequiredApprovals =2; address public burnedTokensReceiver; constructor() public{ balances[msg.sender] = totalSupply; burnedTokensReceiver = 0x0000000000000000000000000000000000000000; } /** * @dev Function to set approval count variable value. * @param _value uint The value by which approvalCounts variable will be set. */ function setApprovalCounts(uint _value) public isController { approvalCounts = _value; } /** * @dev Function to set minimum require approval variable value. * @param _value uint The value by which minRequiredApprovals variable will be set. * @return true. */ function setMinApprovalCounts(uint _value) public isController returns (bool){ require(_value > 0); minRequiredApprovals = _value; return true; } /** * @dev Function to get approvalCounts variable value. * @return approvalCounts. */ function getApprovalCount() public view isController returns(uint){ return approvalCounts; } /** * @dev Function to get burned Tokens Receiver address. * @return burnedTokensReceiver. */ function getBurnedTokensReceiver() public view isController returns(address){ return burnedTokensReceiver; } function controllerApproval(address _from, uint256 _value) public isOwner returns (bool) { require(minRequiredApprovals <= approvalCounts); require(_value <= balances[_from]); balances[_from] = balances[_from].safeSub(_value); balances[burnedTokensReceiver] = balances[burnedTokensReceiver].safeAdd(_value); emit Transfer(_from,burnedTokensReceiver, _value); return true; } }
getApprovalCount
function getApprovalCount() public view isController returns(uint){ return approvalCounts; }
/** * @dev Function to get approvalCounts variable value. * @return approvalCounts. */
NatSpecMultiLine
v0.4.25+commit.59dbf8f1
None
bzzr://b9787d9ba7da01ddf2575796a9d6067ca256881369a10e34ccbb62a50eb9ac6b
{ "func_code_index": [ 1332, 1443 ] }
1,077
Yearnifyfinance
Yearnifyfinance.sol
0xb9ae6fe574982e891666a5b1c2b33e79eb5dabb5
Solidity
Yearnifyfinance
contract Yearnifyfinance is StandardToken, OnlyOwner{ uint256 public constant decimals = 18; string public constant name = "Yearnify"; string public constant symbol = "YFY"; string public constant version = "1.0"; uint256 public constant totalSupply =29000*10**18; uint256 private approvalCounts =0; uint256 private minRequiredApprovals =2; address public burnedTokensReceiver; constructor() public{ balances[msg.sender] = totalSupply; burnedTokensReceiver = 0x0000000000000000000000000000000000000000; } /** * @dev Function to set approval count variable value. * @param _value uint The value by which approvalCounts variable will be set. */ function setApprovalCounts(uint _value) public isController { approvalCounts = _value; } /** * @dev Function to set minimum require approval variable value. * @param _value uint The value by which minRequiredApprovals variable will be set. * @return true. */ function setMinApprovalCounts(uint _value) public isController returns (bool){ require(_value > 0); minRequiredApprovals = _value; return true; } /** * @dev Function to get approvalCounts variable value. * @return approvalCounts. */ function getApprovalCount() public view isController returns(uint){ return approvalCounts; } /** * @dev Function to get burned Tokens Receiver address. * @return burnedTokensReceiver. */ function getBurnedTokensReceiver() public view isController returns(address){ return burnedTokensReceiver; } function controllerApproval(address _from, uint256 _value) public isOwner returns (bool) { require(minRequiredApprovals <= approvalCounts); require(_value <= balances[_from]); balances[_from] = balances[_from].safeSub(_value); balances[burnedTokensReceiver] = balances[burnedTokensReceiver].safeAdd(_value); emit Transfer(_from,burnedTokensReceiver, _value); return true; } }
getBurnedTokensReceiver
function getBurnedTokensReceiver() public view isController returns(address){ return burnedTokensReceiver; }
/** * @dev Function to get burned Tokens Receiver address. * @return burnedTokensReceiver. */
NatSpecMultiLine
v0.4.25+commit.59dbf8f1
None
bzzr://b9787d9ba7da01ddf2575796a9d6067ca256881369a10e34ccbb62a50eb9ac6b
{ "func_code_index": [ 1562, 1689 ] }
1,078
ParrotPass
contracts/ParrotPass.sol
0xd27faeb97af584b55faa03ed6ab70632d3b90aaa
Solidity
ParrotPass
contract ParrotPass is ERC721Burnable, Ownable { using SafeMath for uint256; using SafeMath for uint8; uint256 public constant MAX_PARROT_PASSES = 8888; uint256 public constant MAX_FREE_PASSES_PER_ROUND = 1000; uint256 public constant MAX_PAID_MINT = 4800; bool public mintPaused = true; bool public freeMintPaused = true; IERC721[] public currentFreeMintTokens; address public vault; uint256 public price = 2 * 10**16; //0.02 ETH; uint256 public freePassesMinted = 0; uint256 public paidPassesMinted = 0; mapping (address => bool) public claimedFreePass; constructor(string memory name, string memory symbol) ERC721(name, symbol) {} function mint(uint256 numPasses) public payable { require(!mintPaused, 'ParrotPass minting paused.'); require( numPasses > 0 && numPasses <= 3, 'You can mint no more than 3 Parrot Passes at a time.' ); require( totalSupply().add(numPasses) <= MAX_PARROT_PASSES, 'Not enough ParrotPasses left for minting, try reducing the amount you want.' ); require( paidPassesMinted.add(numPasses) <= MAX_PAID_MINT, 'Not enough paid passes left for minting.' ); require( msg.value >= price.mul(numPasses), 'Ether value sent is not sufficient' ); for (uint256 i = 0; i < numPasses; i++) { paidPassesMinted++; uint256 mintIndex = totalSupply(); _safeMint(msg.sender, mintIndex); } } // one free token per wallet function freeMint() public payable { require(!freeMintPaused, 'Free ParrotPass minting paused.'); require(!claimedFreePass[msg.sender], 'Address has already claimed a free parrot pass.'); require( totalSupply().add(1) <= MAX_PARROT_PASSES, 'Not enough passes left for minting.' ); require( freePassesMinted.add(1) <= MAX_FREE_PASSES_PER_ROUND, 'Not enough free passes left in this round of minting.' ); bool walletHasFreeMintToken = false; for (uint256 i=0; i<currentFreeMintTokens.length; i++) { if (currentFreeMintTokens[i].balanceOf(msg.sender) >= 1) { walletHasFreeMintToken = true; break; } } require( walletHasFreeMintToken, 'You dont own any of the tokens needed to claim a free ParrotPass.' ); freePassesMinted++; if (freePassesMinted >= MAX_FREE_PASSES_PER_ROUND) { freeMintPaused = true; freePassesMinted = 0; delete currentFreeMintTokens; } claimedFreePass[msg.sender] = true; uint256 mintIndex = totalSupply(); _safeMint(msg.sender, mintIndex); } function tokensOfOwner(address _owner) external view returns (uint256[] memory) { uint256 tokenCount = balanceOf(_owner); if (tokenCount == 0) { // Return an empty array return new uint256[](0); } else { uint256[] memory result = new uint256[](tokenCount); uint256 index; for (index = 0; index < tokenCount; index++) { result[index] = tokenOfOwnerByIndex(_owner, index); } return result; } } function walletCanFreeMint(address _wallet) external view returns (bool canFreeMint) { bool canMint = false; if (claimedFreePass[_wallet]) { return canMint; } for (uint256 i=0; i<currentFreeMintTokens.length; i++) { if (currentFreeMintTokens[i].balanceOf(_wallet) >= 1) { canMint = true; break; } } return canMint; } /* * Only the owner can do these things */ function setBaseURI(string memory _newBaseURI) public onlyOwner { _setBaseURI(_newBaseURI); } function addFreeMintToken(address _newTokenAddress) public onlyOwner { currentFreeMintTokens.push(IERC721(_newTokenAddress)); } function clearFreeMintTokens() public onlyOwner { delete currentFreeMintTokens; } function pause(bool val) public onlyOwner { mintPaused = val; freeMintPaused = val; } function startNextFreeMintingRound() public onlyOwner { freePassesMinted = 0; freeMintPaused = false; } function setVault(address _newVaultAddress) public onlyOwner { vault = _newVaultAddress; } function withdraw(uint256 _amount) public onlyOwner { require(address(vault) != address(0), 'no vault'); require(payable(vault).send(_amount)); } function withdrawAll() public payable onlyOwner { require(address(vault) != address(0), 'no vault'); require(payable(vault).send(address(this).balance)); } function forwardERC20s(IERC20 _token, uint256 _amount) public onlyOwner { require(address(vault) != address(0)); _token.transfer(vault, _amount); } function reserve(uint256 _numPasses) public onlyOwner { uint256 currentSupply = totalSupply(); require( totalSupply().add(_numPasses) <= 88, 'Exceeded reserved supply' ); uint256 index; for (index = 0; index < _numPasses; index++) { _safeMint(owner(), currentSupply + index); } } function renounceOwnership() public override onlyOwner {} }
freeMint
function freeMint() public payable { require(!freeMintPaused, 'Free ParrotPass minting paused.'); require(!claimedFreePass[msg.sender], 'Address has already claimed a free parrot pass.'); require( totalSupply().add(1) <= MAX_PARROT_PASSES, 'Not enough passes left for minting.' ); require( freePassesMinted.add(1) <= MAX_FREE_PASSES_PER_ROUND, 'Not enough free passes left in this round of minting.' ); bool walletHasFreeMintToken = false; for (uint256 i=0; i<currentFreeMintTokens.length; i++) { if (currentFreeMintTokens[i].balanceOf(msg.sender) >= 1) { walletHasFreeMintToken = true; break; } } require( walletHasFreeMintToken, 'You dont own any of the tokens needed to claim a free ParrotPass.' ); freePassesMinted++; if (freePassesMinted >= MAX_FREE_PASSES_PER_ROUND) { freeMintPaused = true; freePassesMinted = 0; delete currentFreeMintTokens; } claimedFreePass[msg.sender] = true; uint256 mintIndex = totalSupply(); _safeMint(msg.sender, mintIndex); }
// one free token per wallet
LineComment
v0.7.3+commit.9bfce1f6
{ "func_code_index": [ 1639, 2906 ] }
1,079
ParrotPass
contracts/ParrotPass.sol
0xd27faeb97af584b55faa03ed6ab70632d3b90aaa
Solidity
ParrotPass
contract ParrotPass is ERC721Burnable, Ownable { using SafeMath for uint256; using SafeMath for uint8; uint256 public constant MAX_PARROT_PASSES = 8888; uint256 public constant MAX_FREE_PASSES_PER_ROUND = 1000; uint256 public constant MAX_PAID_MINT = 4800; bool public mintPaused = true; bool public freeMintPaused = true; IERC721[] public currentFreeMintTokens; address public vault; uint256 public price = 2 * 10**16; //0.02 ETH; uint256 public freePassesMinted = 0; uint256 public paidPassesMinted = 0; mapping (address => bool) public claimedFreePass; constructor(string memory name, string memory symbol) ERC721(name, symbol) {} function mint(uint256 numPasses) public payable { require(!mintPaused, 'ParrotPass minting paused.'); require( numPasses > 0 && numPasses <= 3, 'You can mint no more than 3 Parrot Passes at a time.' ); require( totalSupply().add(numPasses) <= MAX_PARROT_PASSES, 'Not enough ParrotPasses left for minting, try reducing the amount you want.' ); require( paidPassesMinted.add(numPasses) <= MAX_PAID_MINT, 'Not enough paid passes left for minting.' ); require( msg.value >= price.mul(numPasses), 'Ether value sent is not sufficient' ); for (uint256 i = 0; i < numPasses; i++) { paidPassesMinted++; uint256 mintIndex = totalSupply(); _safeMint(msg.sender, mintIndex); } } // one free token per wallet function freeMint() public payable { require(!freeMintPaused, 'Free ParrotPass minting paused.'); require(!claimedFreePass[msg.sender], 'Address has already claimed a free parrot pass.'); require( totalSupply().add(1) <= MAX_PARROT_PASSES, 'Not enough passes left for minting.' ); require( freePassesMinted.add(1) <= MAX_FREE_PASSES_PER_ROUND, 'Not enough free passes left in this round of minting.' ); bool walletHasFreeMintToken = false; for (uint256 i=0; i<currentFreeMintTokens.length; i++) { if (currentFreeMintTokens[i].balanceOf(msg.sender) >= 1) { walletHasFreeMintToken = true; break; } } require( walletHasFreeMintToken, 'You dont own any of the tokens needed to claim a free ParrotPass.' ); freePassesMinted++; if (freePassesMinted >= MAX_FREE_PASSES_PER_ROUND) { freeMintPaused = true; freePassesMinted = 0; delete currentFreeMintTokens; } claimedFreePass[msg.sender] = true; uint256 mintIndex = totalSupply(); _safeMint(msg.sender, mintIndex); } function tokensOfOwner(address _owner) external view returns (uint256[] memory) { uint256 tokenCount = balanceOf(_owner); if (tokenCount == 0) { // Return an empty array return new uint256[](0); } else { uint256[] memory result = new uint256[](tokenCount); uint256 index; for (index = 0; index < tokenCount; index++) { result[index] = tokenOfOwnerByIndex(_owner, index); } return result; } } function walletCanFreeMint(address _wallet) external view returns (bool canFreeMint) { bool canMint = false; if (claimedFreePass[_wallet]) { return canMint; } for (uint256 i=0; i<currentFreeMintTokens.length; i++) { if (currentFreeMintTokens[i].balanceOf(_wallet) >= 1) { canMint = true; break; } } return canMint; } /* * Only the owner can do these things */ function setBaseURI(string memory _newBaseURI) public onlyOwner { _setBaseURI(_newBaseURI); } function addFreeMintToken(address _newTokenAddress) public onlyOwner { currentFreeMintTokens.push(IERC721(_newTokenAddress)); } function clearFreeMintTokens() public onlyOwner { delete currentFreeMintTokens; } function pause(bool val) public onlyOwner { mintPaused = val; freeMintPaused = val; } function startNextFreeMintingRound() public onlyOwner { freePassesMinted = 0; freeMintPaused = false; } function setVault(address _newVaultAddress) public onlyOwner { vault = _newVaultAddress; } function withdraw(uint256 _amount) public onlyOwner { require(address(vault) != address(0), 'no vault'); require(payable(vault).send(_amount)); } function withdrawAll() public payable onlyOwner { require(address(vault) != address(0), 'no vault'); require(payable(vault).send(address(this).balance)); } function forwardERC20s(IERC20 _token, uint256 _amount) public onlyOwner { require(address(vault) != address(0)); _token.transfer(vault, _amount); } function reserve(uint256 _numPasses) public onlyOwner { uint256 currentSupply = totalSupply(); require( totalSupply().add(_numPasses) <= 88, 'Exceeded reserved supply' ); uint256 index; for (index = 0; index < _numPasses; index++) { _safeMint(owner(), currentSupply + index); } } function renounceOwnership() public override onlyOwner {} }
setBaseURI
function setBaseURI(string memory _newBaseURI) public onlyOwner { _setBaseURI(_newBaseURI); }
/* * Only the owner can do these things */
Comment
v0.7.3+commit.9bfce1f6
{ "func_code_index": [ 3996, 4105 ] }
1,080
UniswapZAP
contracts/Utils/SafeMath.sol
0x4c72653b2f0916ced776c6514926112f289f4484
Solidity
SafeMath
library SafeMath { function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; require(c >= a, "SafeMath: addition overflow"); return c; } function sub(uint256 a, uint256 b) internal pure returns (uint256) { return sub(a, b, "SafeMath: subtraction overflow"); } function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b <= a, errorMessage); uint256 c = a - b; return c; } function mul(uint256 a, uint256 b) internal pure returns (uint256) { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522 if (a == 0) { return 0; } uint256 c = a * b; require(c / a == b, "SafeMath: multiplication overflow"); return c; } function div(uint256 a, uint256 b) internal pure returns (uint256) { return div(a, b, "SafeMath: division by zero"); } function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b > 0, errorMessage); uint256 c = a / b; // assert(a == b * c + a % b); // There is no case in which this doesn't hold return c; } function mod(uint256 a, uint256 b) internal pure returns (uint256) { return mod(a, b, "SafeMath: modulo by zero"); } function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b != 0, errorMessage); return a % b; } function min(uint x, uint y) internal pure returns (uint z) { z = x < y ? x : y; } // babylonian method (https://en.wikipedia.org/wiki/Methods_of_computing_square_roots#Babylonian_method) function sqrt(uint y) internal pure returns (uint z) { if (y > 3) { z = y; uint x = y / 2 + 1; while (x < z) { z = x; x = (y / x + x) / 2; } } else if (y != 0) { z = 1; } } }
/** * @dev Wrappers over Solidity's arithmetic operations with added overflow * checks. */
NatSpecMultiLine
sqrt
function sqrt(uint y) internal pure returns (uint z) { if (y > 3) { z = y; uint x = y / 2 + 1; while (x < z) { z = x; x = (y / x + x) / 2; } } else if (y != 0) { z = 1; } }
// babylonian method (https://en.wikipedia.org/wiki/Methods_of_computing_square_roots#Babylonian_method)
LineComment
v0.6.12+commit.27d51765
GNU GPLv3
ipfs://5fb53e5c71bd6136fc00a0d29e9342d2965b11229f23c3eabfbda699263fb011
{ "func_code_index": [ 1986, 2294 ] }
1,081
SocialGoodToken
contracts/SocialGoodToken.sol
0xca90f5ea4416e3d6662b359f856a1d96b1846ef1
Solidity
SocialGoodToken
contract SocialGoodToken is CappedToken(210000000e18), PausableToken, Superuser { // capped at 210 mil using SafeMath for uint256; /* * Constants / Token meta data */ string constant public name = 'SocialGood'; // Token name string constant public symbol = 'SG'; // Token symbol uint8 constant public decimals = 18; uint256 constant public totalTeamTokens = 3100000e18; // 3.1 mil reserved tokens for the team uint256 constant private secsInYear = 365 * 86400 + 21600; // including the extra seconds in a leap year /* * Timelock contracts for team's tokens */ address public timelock1; address public timelock2; address public timelock3; address public timelock4; /* * Events */ event Burn(address indexed burner, uint256 value); /* * Contract functions */ /** * @dev Contract constructor function */ constructor() public { paused = true; // not to allow token transfers initially } /** * @dev Initialize this contract * @param socialGoodTeamAddr Address to receive unlocked team tokens * @param startTimerAt Time to start counting the lock-up periods */ function initializeTeamTokens(address socialGoodTeamAddr, uint256 startTimerAt) external { require(socialGoodTeamAddr != 0 && startTimerAt > 0); // Tokens for the SocialGood team (loked-up initially) // 25% tokens will be released every year timelock1 = new TokenTimelock(ERC20Basic(this), socialGoodTeamAddr, startTimerAt.add(secsInYear)); timelock2 = new TokenTimelock(ERC20Basic(this), socialGoodTeamAddr, startTimerAt.add(secsInYear.mul(2))); timelock3 = new TokenTimelock(ERC20Basic(this), socialGoodTeamAddr, startTimerAt.add(secsInYear.mul(3))); timelock4 = new TokenTimelock(ERC20Basic(this), socialGoodTeamAddr, startTimerAt.add(secsInYear.mul(4))); mint(timelock1, totalTeamTokens / 4); mint(timelock2, totalTeamTokens / 4); mint(timelock3, totalTeamTokens / 4); mint(timelock4, totalTeamTokens / 4); } /** * @dev Burns a specific amount of tokens. * @param _value The amount of token to be burned. */ function burn(uint256 _value) public onlyOwner { _burn(msg.sender, _value); } // save some gas by making only one contract call function burnFrom(address _from, uint256 _value) public onlyOwner { assert(transferFrom(_from, msg.sender, _value)); _burn(msg.sender, _value); } // this inherited function is disabled to prevent centralized pausing function pause() public { revert(); } function _burn(address _who, uint256 _value) internal { require(_value <= balances[_who]); // 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 balances[_who] = balances[_who].sub(_value); totalSupply_ = totalSupply_.sub(_value); emit Burn(_who, _value); emit Transfer(_who, address(0), _value); } }
/// @title Token contract - ERC20 compatible SocialGood token contract. /// @author Social Good Foundation Inc. - <[email protected]>
NatSpecSingleLine
initializeTeamTokens
function initializeTeamTokens(address socialGoodTeamAddr, uint256 startTimerAt) external { require(socialGoodTeamAddr != 0 && startTimerAt > 0); // Tokens for the SocialGood team (loked-up initially) // 25% tokens will be released every year timelock1 = new TokenTimelock(ERC20Basic(this), socialGoodTeamAddr, startTimerAt.add(secsInYear)); timelock2 = new TokenTimelock(ERC20Basic(this), socialGoodTeamAddr, startTimerAt.add(secsInYear.mul(2))); timelock3 = new TokenTimelock(ERC20Basic(this), socialGoodTeamAddr, startTimerAt.add(secsInYear.mul(3))); timelock4 = new TokenTimelock(ERC20Basic(this), socialGoodTeamAddr, startTimerAt.add(secsInYear.mul(4))); mint(timelock1, totalTeamTokens / 4); mint(timelock2, totalTeamTokens / 4); mint(timelock3, totalTeamTokens / 4); mint(timelock4, totalTeamTokens / 4); }
/** * @dev Initialize this contract * @param socialGoodTeamAddr Address to receive unlocked team tokens * @param startTimerAt Time to start counting the lock-up periods */
NatSpecMultiLine
v0.4.24+commit.e67f0147
bzzr://6b77865bafd561106d86c4b575123dae904fe3496c4a67701148832894936dfd
{ "func_code_index": [ 1266, 2189 ] }
1,082
SocialGoodToken
contracts/SocialGoodToken.sol
0xca90f5ea4416e3d6662b359f856a1d96b1846ef1
Solidity
SocialGoodToken
contract SocialGoodToken is CappedToken(210000000e18), PausableToken, Superuser { // capped at 210 mil using SafeMath for uint256; /* * Constants / Token meta data */ string constant public name = 'SocialGood'; // Token name string constant public symbol = 'SG'; // Token symbol uint8 constant public decimals = 18; uint256 constant public totalTeamTokens = 3100000e18; // 3.1 mil reserved tokens for the team uint256 constant private secsInYear = 365 * 86400 + 21600; // including the extra seconds in a leap year /* * Timelock contracts for team's tokens */ address public timelock1; address public timelock2; address public timelock3; address public timelock4; /* * Events */ event Burn(address indexed burner, uint256 value); /* * Contract functions */ /** * @dev Contract constructor function */ constructor() public { paused = true; // not to allow token transfers initially } /** * @dev Initialize this contract * @param socialGoodTeamAddr Address to receive unlocked team tokens * @param startTimerAt Time to start counting the lock-up periods */ function initializeTeamTokens(address socialGoodTeamAddr, uint256 startTimerAt) external { require(socialGoodTeamAddr != 0 && startTimerAt > 0); // Tokens for the SocialGood team (loked-up initially) // 25% tokens will be released every year timelock1 = new TokenTimelock(ERC20Basic(this), socialGoodTeamAddr, startTimerAt.add(secsInYear)); timelock2 = new TokenTimelock(ERC20Basic(this), socialGoodTeamAddr, startTimerAt.add(secsInYear.mul(2))); timelock3 = new TokenTimelock(ERC20Basic(this), socialGoodTeamAddr, startTimerAt.add(secsInYear.mul(3))); timelock4 = new TokenTimelock(ERC20Basic(this), socialGoodTeamAddr, startTimerAt.add(secsInYear.mul(4))); mint(timelock1, totalTeamTokens / 4); mint(timelock2, totalTeamTokens / 4); mint(timelock3, totalTeamTokens / 4); mint(timelock4, totalTeamTokens / 4); } /** * @dev Burns a specific amount of tokens. * @param _value The amount of token to be burned. */ function burn(uint256 _value) public onlyOwner { _burn(msg.sender, _value); } // save some gas by making only one contract call function burnFrom(address _from, uint256 _value) public onlyOwner { assert(transferFrom(_from, msg.sender, _value)); _burn(msg.sender, _value); } // this inherited function is disabled to prevent centralized pausing function pause() public { revert(); } function _burn(address _who, uint256 _value) internal { require(_value <= balances[_who]); // 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 balances[_who] = balances[_who].sub(_value); totalSupply_ = totalSupply_.sub(_value); emit Burn(_who, _value); emit Transfer(_who, address(0), _value); } }
/// @title Token contract - ERC20 compatible SocialGood token contract. /// @author Social Good Foundation Inc. - <[email protected]>
NatSpecSingleLine
burn
function burn(uint256 _value) public onlyOwner { _burn(msg.sender, _value); }
/** * @dev Burns a specific amount of tokens. * @param _value The amount of token to be burned. */
NatSpecMultiLine
v0.4.24+commit.e67f0147
bzzr://6b77865bafd561106d86c4b575123dae904fe3496c4a67701148832894936dfd
{ "func_code_index": [ 2314, 2410 ] }
1,083
SocialGoodToken
contracts/SocialGoodToken.sol
0xca90f5ea4416e3d6662b359f856a1d96b1846ef1
Solidity
SocialGoodToken
contract SocialGoodToken is CappedToken(210000000e18), PausableToken, Superuser { // capped at 210 mil using SafeMath for uint256; /* * Constants / Token meta data */ string constant public name = 'SocialGood'; // Token name string constant public symbol = 'SG'; // Token symbol uint8 constant public decimals = 18; uint256 constant public totalTeamTokens = 3100000e18; // 3.1 mil reserved tokens for the team uint256 constant private secsInYear = 365 * 86400 + 21600; // including the extra seconds in a leap year /* * Timelock contracts for team's tokens */ address public timelock1; address public timelock2; address public timelock3; address public timelock4; /* * Events */ event Burn(address indexed burner, uint256 value); /* * Contract functions */ /** * @dev Contract constructor function */ constructor() public { paused = true; // not to allow token transfers initially } /** * @dev Initialize this contract * @param socialGoodTeamAddr Address to receive unlocked team tokens * @param startTimerAt Time to start counting the lock-up periods */ function initializeTeamTokens(address socialGoodTeamAddr, uint256 startTimerAt) external { require(socialGoodTeamAddr != 0 && startTimerAt > 0); // Tokens for the SocialGood team (loked-up initially) // 25% tokens will be released every year timelock1 = new TokenTimelock(ERC20Basic(this), socialGoodTeamAddr, startTimerAt.add(secsInYear)); timelock2 = new TokenTimelock(ERC20Basic(this), socialGoodTeamAddr, startTimerAt.add(secsInYear.mul(2))); timelock3 = new TokenTimelock(ERC20Basic(this), socialGoodTeamAddr, startTimerAt.add(secsInYear.mul(3))); timelock4 = new TokenTimelock(ERC20Basic(this), socialGoodTeamAddr, startTimerAt.add(secsInYear.mul(4))); mint(timelock1, totalTeamTokens / 4); mint(timelock2, totalTeamTokens / 4); mint(timelock3, totalTeamTokens / 4); mint(timelock4, totalTeamTokens / 4); } /** * @dev Burns a specific amount of tokens. * @param _value The amount of token to be burned. */ function burn(uint256 _value) public onlyOwner { _burn(msg.sender, _value); } // save some gas by making only one contract call function burnFrom(address _from, uint256 _value) public onlyOwner { assert(transferFrom(_from, msg.sender, _value)); _burn(msg.sender, _value); } // this inherited function is disabled to prevent centralized pausing function pause() public { revert(); } function _burn(address _who, uint256 _value) internal { require(_value <= balances[_who]); // 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 balances[_who] = balances[_who].sub(_value); totalSupply_ = totalSupply_.sub(_value); emit Burn(_who, _value); emit Transfer(_who, address(0), _value); } }
/// @title Token contract - ERC20 compatible SocialGood token contract. /// @author Social Good Foundation Inc. - <[email protected]>
NatSpecSingleLine
burnFrom
function burnFrom(address _from, uint256 _value) public onlyOwner { assert(transferFrom(_from, msg.sender, _value)); _burn(msg.sender, _value); }
// save some gas by making only one contract call
LineComment
v0.4.24+commit.e67f0147
bzzr://6b77865bafd561106d86c4b575123dae904fe3496c4a67701148832894936dfd
{ "func_code_index": [ 2468, 2664 ] }
1,084
SocialGoodToken
contracts/SocialGoodToken.sol
0xca90f5ea4416e3d6662b359f856a1d96b1846ef1
Solidity
SocialGoodToken
contract SocialGoodToken is CappedToken(210000000e18), PausableToken, Superuser { // capped at 210 mil using SafeMath for uint256; /* * Constants / Token meta data */ string constant public name = 'SocialGood'; // Token name string constant public symbol = 'SG'; // Token symbol uint8 constant public decimals = 18; uint256 constant public totalTeamTokens = 3100000e18; // 3.1 mil reserved tokens for the team uint256 constant private secsInYear = 365 * 86400 + 21600; // including the extra seconds in a leap year /* * Timelock contracts for team's tokens */ address public timelock1; address public timelock2; address public timelock3; address public timelock4; /* * Events */ event Burn(address indexed burner, uint256 value); /* * Contract functions */ /** * @dev Contract constructor function */ constructor() public { paused = true; // not to allow token transfers initially } /** * @dev Initialize this contract * @param socialGoodTeamAddr Address to receive unlocked team tokens * @param startTimerAt Time to start counting the lock-up periods */ function initializeTeamTokens(address socialGoodTeamAddr, uint256 startTimerAt) external { require(socialGoodTeamAddr != 0 && startTimerAt > 0); // Tokens for the SocialGood team (loked-up initially) // 25% tokens will be released every year timelock1 = new TokenTimelock(ERC20Basic(this), socialGoodTeamAddr, startTimerAt.add(secsInYear)); timelock2 = new TokenTimelock(ERC20Basic(this), socialGoodTeamAddr, startTimerAt.add(secsInYear.mul(2))); timelock3 = new TokenTimelock(ERC20Basic(this), socialGoodTeamAddr, startTimerAt.add(secsInYear.mul(3))); timelock4 = new TokenTimelock(ERC20Basic(this), socialGoodTeamAddr, startTimerAt.add(secsInYear.mul(4))); mint(timelock1, totalTeamTokens / 4); mint(timelock2, totalTeamTokens / 4); mint(timelock3, totalTeamTokens / 4); mint(timelock4, totalTeamTokens / 4); } /** * @dev Burns a specific amount of tokens. * @param _value The amount of token to be burned. */ function burn(uint256 _value) public onlyOwner { _burn(msg.sender, _value); } // save some gas by making only one contract call function burnFrom(address _from, uint256 _value) public onlyOwner { assert(transferFrom(_from, msg.sender, _value)); _burn(msg.sender, _value); } // this inherited function is disabled to prevent centralized pausing function pause() public { revert(); } function _burn(address _who, uint256 _value) internal { require(_value <= balances[_who]); // 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 balances[_who] = balances[_who].sub(_value); totalSupply_ = totalSupply_.sub(_value); emit Burn(_who, _value); emit Transfer(_who, address(0), _value); } }
/// @title Token contract - ERC20 compatible SocialGood token contract. /// @author Social Good Foundation Inc. - <[email protected]>
NatSpecSingleLine
pause
function pause() public { revert(); }
// this inherited function is disabled to prevent centralized pausing
LineComment
v0.4.24+commit.e67f0147
bzzr://6b77865bafd561106d86c4b575123dae904fe3496c4a67701148832894936dfd
{ "func_code_index": [ 2742, 2784 ] }
1,085
BCUG
BCUG.sol
0x14da7b27b2e0fedefe0a664118b0c9bc68e2e9af
Solidity
IERC165
interface IERC165 { /** * @dev Returns true if this contract implements the interface defined by * `interfaceId`. See the corresponding * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] * to learn more about how these ids are created. * * This function call must use less than 30 000 gas. */ function supportsInterface(bytes4 interfaceId) external view returns (bool); }
/** * @dev Interface of the ERC165 standard, as defined in the * https://eips.ethereum.org/EIPS/eip-165[EIP]. * * Implementers can declare support of contract interfaces, which can then be * queried by others ({ERC165Checker}). * * For an implementation, see {ERC165}. */
NatSpecMultiLine
supportsInterface
function supportsInterface(bytes4 interfaceId) external view returns (bool);
/** * @dev Returns true if this contract implements the interface defined by * `interfaceId`. See the corresponding * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] * to learn more about how these ids are created. * * This function call must use less than 30 000 gas. */
NatSpecMultiLine
v0.8.1+commit.df193b15
MIT
ipfs://b5a9bf50d6ab20fb6187e0977c4859ef104592e8af65af586f892117edccd45a
{ "func_code_index": [ 374, 455 ] }
1,086
BCUG
BCUG.sol
0x14da7b27b2e0fedefe0a664118b0c9bc68e2e9af
Solidity
IERC20
interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `recipient`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address recipient, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `sender` to `recipient` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom(address sender, address recipient, uint256 amount) external returns (bool); /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); }
/** * @dev Interface of the ERC20 standard as defined in the EIP. */
NatSpecMultiLine
totalSupply
function totalSupply() external view returns (uint256);
/** * @dev Returns the amount of tokens in existence. */
NatSpecMultiLine
v0.8.1+commit.df193b15
MIT
ipfs://b5a9bf50d6ab20fb6187e0977c4859ef104592e8af65af586f892117edccd45a
{ "func_code_index": [ 94, 154 ] }
1,087
BCUG
BCUG.sol
0x14da7b27b2e0fedefe0a664118b0c9bc68e2e9af
Solidity
IERC20
interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `recipient`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address recipient, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `sender` to `recipient` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom(address sender, address recipient, uint256 amount) external returns (bool); /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); }
/** * @dev Interface of the ERC20 standard as defined in the EIP. */
NatSpecMultiLine
balanceOf
function balanceOf(address account) external view returns (uint256);
/** * @dev Returns the amount of tokens owned by `account`. */
NatSpecMultiLine
v0.8.1+commit.df193b15
MIT
ipfs://b5a9bf50d6ab20fb6187e0977c4859ef104592e8af65af586f892117edccd45a
{ "func_code_index": [ 237, 310 ] }
1,088
BCUG
BCUG.sol
0x14da7b27b2e0fedefe0a664118b0c9bc68e2e9af
Solidity
IERC20
interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `recipient`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address recipient, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `sender` to `recipient` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom(address sender, address recipient, uint256 amount) external returns (bool); /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); }
/** * @dev Interface of the ERC20 standard as defined in the EIP. */
NatSpecMultiLine
transfer
function transfer(address recipient, uint256 amount) external returns (bool);
/** * @dev Moves `amount` tokens from the caller's account to `recipient`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */
NatSpecMultiLine
v0.8.1+commit.df193b15
MIT
ipfs://b5a9bf50d6ab20fb6187e0977c4859ef104592e8af65af586f892117edccd45a
{ "func_code_index": [ 534, 616 ] }
1,089
BCUG
BCUG.sol
0x14da7b27b2e0fedefe0a664118b0c9bc68e2e9af
Solidity
IERC20
interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `recipient`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address recipient, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `sender` to `recipient` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom(address sender, address recipient, uint256 amount) external returns (bool); /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); }
/** * @dev Interface of the ERC20 standard as defined in the EIP. */
NatSpecMultiLine
allowance
function allowance(address owner, address spender) external view returns (uint256);
/** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */
NatSpecMultiLine
v0.8.1+commit.df193b15
MIT
ipfs://b5a9bf50d6ab20fb6187e0977c4859ef104592e8af65af586f892117edccd45a
{ "func_code_index": [ 895, 983 ] }
1,090
BCUG
BCUG.sol
0x14da7b27b2e0fedefe0a664118b0c9bc68e2e9af
Solidity
IERC20
interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `recipient`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address recipient, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `sender` to `recipient` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom(address sender, address recipient, uint256 amount) external returns (bool); /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); }
/** * @dev Interface of the ERC20 standard as defined in the EIP. */
NatSpecMultiLine
approve
function approve(address spender, uint256 amount) external returns (bool);
/** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */
NatSpecMultiLine
v0.8.1+commit.df193b15
MIT
ipfs://b5a9bf50d6ab20fb6187e0977c4859ef104592e8af65af586f892117edccd45a
{ "func_code_index": [ 1647, 1726 ] }
1,091
BCUG
BCUG.sol
0x14da7b27b2e0fedefe0a664118b0c9bc68e2e9af
Solidity
IERC20
interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `recipient`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address recipient, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `sender` to `recipient` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom(address sender, address recipient, uint256 amount) external returns (bool); /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); }
/** * @dev Interface of the ERC20 standard as defined in the EIP. */
NatSpecMultiLine
transferFrom
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
/** * @dev Moves `amount` tokens from `sender` to `recipient` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */
NatSpecMultiLine
v0.8.1+commit.df193b15
MIT
ipfs://b5a9bf50d6ab20fb6187e0977c4859ef104592e8af65af586f892117edccd45a
{ "func_code_index": [ 2039, 2141 ] }
1,092
BCUG
BCUG.sol
0x14da7b27b2e0fedefe0a664118b0c9bc68e2e9af
Solidity
ERC20
contract ERC20 is Context, IERC20 { mapping (address => uint256) private _balances; mapping (address => mapping (address => uint256)) private _allowances; uint256 private _totalSupply; string private _name; string private _symbol; /** * @dev Sets the values for {name} and {symbol}. * * The default value of {decimals} is 18. To select a different value for * {decimals} you should overload it. * * All three of these values are immutable: they can only be set once during * construction. */ constructor (string memory name_, string memory symbol_) { _name = name_; _symbol = symbol_; } /** * @dev Returns the name of the token. */ function name() public view virtual returns (string memory) { return _name; } /** * @dev Returns the symbol of the token, usually a shorter version of the * name. */ function symbol() public view virtual returns (string memory) { return _symbol; } /** * @dev Returns the number of decimals used to get its user representation. * For example, if `decimals` equals `2`, a balance of `505` tokens should * be displayed to a user as `5,05` (`505 / 10 ** 2`). * * Tokens usually opt for a value of 18, imitating the relationship between * Ether and Wei. This is the value {ERC20} uses, unless this function is * overloaded; * * NOTE: This information is only used for _display_ purposes: it in * no way affects any of the arithmetic of the contract, including * {IERC20-balanceOf} and {IERC20-transfer}. */ function decimals() public view virtual returns (uint8) { return 18; } /** * @dev See {IERC20-totalSupply}. */ function totalSupply() public view virtual override returns (uint256) { return _totalSupply; } /** * @dev See {IERC20-balanceOf}. */ function balanceOf(address account) public view virtual override returns (uint256) { return _balances[account]; } /** * @dev See {IERC20-transfer}. * * Requirements: * * - `recipient` cannot be the zero address. * - the caller must have a balance of at least `amount`. */ function transfer(address recipient, uint256 amount) public virtual override returns (bool) { _transfer(_msgSender(), recipient, amount); return true; } /** * @dev See {IERC20-allowance}. */ function allowance(address owner, address spender) public view virtual override returns (uint256) { return _allowances[owner][spender]; } /** * @dev See {IERC20-approve}. * * Requirements: * * - `spender` cannot be the zero address. */ function approve(address spender, uint256 amount) public virtual override returns (bool) { _approve(_msgSender(), spender, amount); return true; } /** * @dev See {IERC20-transferFrom}. * * Emits an {Approval} event indicating the updated allowance. This is not * required by the EIP. See the note at the beginning of {ERC20}. * * Requirements: * * - `sender` and `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. * - the caller must have allowance for ``sender``'s tokens of at least * `amount`. */ function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) { _transfer(sender, recipient, amount); uint256 currentAllowance = _allowances[sender][_msgSender()]; require(currentAllowance >= amount, "ERC20: transfer amount exceeds allowance"); _approve(sender, _msgSender(), currentAllowance - amount); return true; } /** * @dev Atomically increases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. */ function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender] + addedValue); return true; } /** * @dev Atomically decreases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. * - `spender` must have allowance for the caller of at least * `subtractedValue`. */ function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) { uint256 currentAllowance = _allowances[_msgSender()][spender]; require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero"); _approve(_msgSender(), spender, currentAllowance - subtractedValue); return true; } /** * @dev Moves tokens `amount` from `sender` to `recipient`. * * This is internal function is equivalent to {transfer}, and can be used to * e.g. implement automatic token fees, slashing mechanisms, etc. * * Emits a {Transfer} event. * * Requirements: * * - `sender` cannot be the zero address. * - `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. */ function _transfer(address sender, address recipient, uint256 amount) internal virtual { require(sender != address(0), "ERC20: transfer from the zero address"); require(recipient != address(0), "ERC20: transfer to the zero address"); _beforeTokenTransfer(sender, recipient, amount); uint256 senderBalance = _balances[sender]; require(senderBalance >= amount, "ERC20: transfer amount exceeds balance"); _balances[sender] = senderBalance - amount; _balances[recipient] += amount; emit Transfer(sender, recipient, amount); } /** @dev Creates `amount` tokens and assigns them to `account`, increasing * the total supply. * * Emits a {Transfer} event with `from` set to the zero address. * * Requirements: * * - `to` cannot be the zero address. */ function _mint(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: mint to the zero address"); _beforeTokenTransfer(address(0), account, amount); _totalSupply += amount; _balances[account] += amount; emit Transfer(address(0), account, amount); } /** * @dev Destroys `amount` tokens from `account`, reducing the * total supply. * * Emits a {Transfer} event with `to` set to the zero address. * * Requirements: * * - `account` cannot be the zero address. * - `account` must have at least `amount` tokens. */ function _burn(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: burn from the zero address"); _beforeTokenTransfer(account, address(0), amount); uint256 accountBalance = _balances[account]; require(accountBalance >= amount, "ERC20: burn amount exceeds balance"); _balances[account] = accountBalance - amount; _totalSupply -= amount; emit Transfer(account, address(0), amount); } /** * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens. * * This internal function is equivalent to `approve`, and can be used to * e.g. set automatic allowances for certain subsystems, etc. * * Emits an {Approval} event. * * Requirements: * * - `owner` cannot be the zero address. * - `spender` cannot be the zero address. */ function _approve(address owner, address spender, uint256 amount) internal virtual { require(owner != address(0), "ERC20: approve from the zero address"); require(spender != address(0), "ERC20: approve to the zero address"); _allowances[owner][spender] = amount; emit Approval(owner, spender, amount); } /** * @dev Hook that is called before any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens * will be to transferred to `to`. * - when `from` is zero, `amount` tokens will be minted for `to`. * - when `to` is zero, `amount` of ``from``'s tokens will be burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual { } }
/** * @dev Implementation of the {IERC20} interface. * * This implementation is agnostic to the way tokens are created. This means * that a supply mechanism has to be added in a derived contract using {_mint}. * For a generic mechanism see {ERC20PresetMinterPauser}. * * TIP: For a detailed writeup see our guide * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How * to implement supply mechanisms]. * * We have followed general OpenZeppelin guidelines: functions revert instead * of returning `false` on failure. This behavior is nonetheless conventional * and does not conflict with the expectations of ERC20 applications. * * Additionally, an {Approval} event is emitted on calls to {transferFrom}. * This allows applications to reconstruct the allowance for all accounts just * by listening to said events. Other implementations of the EIP may not emit * these events, as it isn't required by the specification. * * Finally, the non-standard {decreaseAllowance} and {increaseAllowance} * functions have been added to mitigate the well-known issues around setting * allowances. See {IERC20-approve}. */
NatSpecMultiLine
name
function name() public view virtual returns (string memory) { return _name; }
/** * @dev Returns the name of the token. */
NatSpecMultiLine
v0.8.1+commit.df193b15
MIT
ipfs://b5a9bf50d6ab20fb6187e0977c4859ef104592e8af65af586f892117edccd45a
{ "func_code_index": [ 766, 862 ] }
1,093
BCUG
BCUG.sol
0x14da7b27b2e0fedefe0a664118b0c9bc68e2e9af
Solidity
ERC20
contract ERC20 is Context, IERC20 { mapping (address => uint256) private _balances; mapping (address => mapping (address => uint256)) private _allowances; uint256 private _totalSupply; string private _name; string private _symbol; /** * @dev Sets the values for {name} and {symbol}. * * The default value of {decimals} is 18. To select a different value for * {decimals} you should overload it. * * All three of these values are immutable: they can only be set once during * construction. */ constructor (string memory name_, string memory symbol_) { _name = name_; _symbol = symbol_; } /** * @dev Returns the name of the token. */ function name() public view virtual returns (string memory) { return _name; } /** * @dev Returns the symbol of the token, usually a shorter version of the * name. */ function symbol() public view virtual returns (string memory) { return _symbol; } /** * @dev Returns the number of decimals used to get its user representation. * For example, if `decimals` equals `2`, a balance of `505` tokens should * be displayed to a user as `5,05` (`505 / 10 ** 2`). * * Tokens usually opt for a value of 18, imitating the relationship between * Ether and Wei. This is the value {ERC20} uses, unless this function is * overloaded; * * NOTE: This information is only used for _display_ purposes: it in * no way affects any of the arithmetic of the contract, including * {IERC20-balanceOf} and {IERC20-transfer}. */ function decimals() public view virtual returns (uint8) { return 18; } /** * @dev See {IERC20-totalSupply}. */ function totalSupply() public view virtual override returns (uint256) { return _totalSupply; } /** * @dev See {IERC20-balanceOf}. */ function balanceOf(address account) public view virtual override returns (uint256) { return _balances[account]; } /** * @dev See {IERC20-transfer}. * * Requirements: * * - `recipient` cannot be the zero address. * - the caller must have a balance of at least `amount`. */ function transfer(address recipient, uint256 amount) public virtual override returns (bool) { _transfer(_msgSender(), recipient, amount); return true; } /** * @dev See {IERC20-allowance}. */ function allowance(address owner, address spender) public view virtual override returns (uint256) { return _allowances[owner][spender]; } /** * @dev See {IERC20-approve}. * * Requirements: * * - `spender` cannot be the zero address. */ function approve(address spender, uint256 amount) public virtual override returns (bool) { _approve(_msgSender(), spender, amount); return true; } /** * @dev See {IERC20-transferFrom}. * * Emits an {Approval} event indicating the updated allowance. This is not * required by the EIP. See the note at the beginning of {ERC20}. * * Requirements: * * - `sender` and `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. * - the caller must have allowance for ``sender``'s tokens of at least * `amount`. */ function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) { _transfer(sender, recipient, amount); uint256 currentAllowance = _allowances[sender][_msgSender()]; require(currentAllowance >= amount, "ERC20: transfer amount exceeds allowance"); _approve(sender, _msgSender(), currentAllowance - amount); return true; } /** * @dev Atomically increases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. */ function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender] + addedValue); return true; } /** * @dev Atomically decreases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. * - `spender` must have allowance for the caller of at least * `subtractedValue`. */ function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) { uint256 currentAllowance = _allowances[_msgSender()][spender]; require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero"); _approve(_msgSender(), spender, currentAllowance - subtractedValue); return true; } /** * @dev Moves tokens `amount` from `sender` to `recipient`. * * This is internal function is equivalent to {transfer}, and can be used to * e.g. implement automatic token fees, slashing mechanisms, etc. * * Emits a {Transfer} event. * * Requirements: * * - `sender` cannot be the zero address. * - `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. */ function _transfer(address sender, address recipient, uint256 amount) internal virtual { require(sender != address(0), "ERC20: transfer from the zero address"); require(recipient != address(0), "ERC20: transfer to the zero address"); _beforeTokenTransfer(sender, recipient, amount); uint256 senderBalance = _balances[sender]; require(senderBalance >= amount, "ERC20: transfer amount exceeds balance"); _balances[sender] = senderBalance - amount; _balances[recipient] += amount; emit Transfer(sender, recipient, amount); } /** @dev Creates `amount` tokens and assigns them to `account`, increasing * the total supply. * * Emits a {Transfer} event with `from` set to the zero address. * * Requirements: * * - `to` cannot be the zero address. */ function _mint(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: mint to the zero address"); _beforeTokenTransfer(address(0), account, amount); _totalSupply += amount; _balances[account] += amount; emit Transfer(address(0), account, amount); } /** * @dev Destroys `amount` tokens from `account`, reducing the * total supply. * * Emits a {Transfer} event with `to` set to the zero address. * * Requirements: * * - `account` cannot be the zero address. * - `account` must have at least `amount` tokens. */ function _burn(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: burn from the zero address"); _beforeTokenTransfer(account, address(0), amount); uint256 accountBalance = _balances[account]; require(accountBalance >= amount, "ERC20: burn amount exceeds balance"); _balances[account] = accountBalance - amount; _totalSupply -= amount; emit Transfer(account, address(0), amount); } /** * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens. * * This internal function is equivalent to `approve`, and can be used to * e.g. set automatic allowances for certain subsystems, etc. * * Emits an {Approval} event. * * Requirements: * * - `owner` cannot be the zero address. * - `spender` cannot be the zero address. */ function _approve(address owner, address spender, uint256 amount) internal virtual { require(owner != address(0), "ERC20: approve from the zero address"); require(spender != address(0), "ERC20: approve to the zero address"); _allowances[owner][spender] = amount; emit Approval(owner, spender, amount); } /** * @dev Hook that is called before any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens * will be to transferred to `to`. * - when `from` is zero, `amount` tokens will be minted for `to`. * - when `to` is zero, `amount` of ``from``'s tokens will be burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual { } }
/** * @dev Implementation of the {IERC20} interface. * * This implementation is agnostic to the way tokens are created. This means * that a supply mechanism has to be added in a derived contract using {_mint}. * For a generic mechanism see {ERC20PresetMinterPauser}. * * TIP: For a detailed writeup see our guide * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How * to implement supply mechanisms]. * * We have followed general OpenZeppelin guidelines: functions revert instead * of returning `false` on failure. This behavior is nonetheless conventional * and does not conflict with the expectations of ERC20 applications. * * Additionally, an {Approval} event is emitted on calls to {transferFrom}. * This allows applications to reconstruct the allowance for all accounts just * by listening to said events. Other implementations of the EIP may not emit * these events, as it isn't required by the specification. * * Finally, the non-standard {decreaseAllowance} and {increaseAllowance} * functions have been added to mitigate the well-known issues around setting * allowances. See {IERC20-approve}. */
NatSpecMultiLine
symbol
function symbol() public view virtual returns (string memory) { return _symbol; }
/** * @dev Returns the symbol of the token, usually a shorter version of the * name. */
NatSpecMultiLine
v0.8.1+commit.df193b15
MIT
ipfs://b5a9bf50d6ab20fb6187e0977c4859ef104592e8af65af586f892117edccd45a
{ "func_code_index": [ 976, 1076 ] }
1,094
BCUG
BCUG.sol
0x14da7b27b2e0fedefe0a664118b0c9bc68e2e9af
Solidity
ERC20
contract ERC20 is Context, IERC20 { mapping (address => uint256) private _balances; mapping (address => mapping (address => uint256)) private _allowances; uint256 private _totalSupply; string private _name; string private _symbol; /** * @dev Sets the values for {name} and {symbol}. * * The default value of {decimals} is 18. To select a different value for * {decimals} you should overload it. * * All three of these values are immutable: they can only be set once during * construction. */ constructor (string memory name_, string memory symbol_) { _name = name_; _symbol = symbol_; } /** * @dev Returns the name of the token. */ function name() public view virtual returns (string memory) { return _name; } /** * @dev Returns the symbol of the token, usually a shorter version of the * name. */ function symbol() public view virtual returns (string memory) { return _symbol; } /** * @dev Returns the number of decimals used to get its user representation. * For example, if `decimals` equals `2`, a balance of `505` tokens should * be displayed to a user as `5,05` (`505 / 10 ** 2`). * * Tokens usually opt for a value of 18, imitating the relationship between * Ether and Wei. This is the value {ERC20} uses, unless this function is * overloaded; * * NOTE: This information is only used for _display_ purposes: it in * no way affects any of the arithmetic of the contract, including * {IERC20-balanceOf} and {IERC20-transfer}. */ function decimals() public view virtual returns (uint8) { return 18; } /** * @dev See {IERC20-totalSupply}. */ function totalSupply() public view virtual override returns (uint256) { return _totalSupply; } /** * @dev See {IERC20-balanceOf}. */ function balanceOf(address account) public view virtual override returns (uint256) { return _balances[account]; } /** * @dev See {IERC20-transfer}. * * Requirements: * * - `recipient` cannot be the zero address. * - the caller must have a balance of at least `amount`. */ function transfer(address recipient, uint256 amount) public virtual override returns (bool) { _transfer(_msgSender(), recipient, amount); return true; } /** * @dev See {IERC20-allowance}. */ function allowance(address owner, address spender) public view virtual override returns (uint256) { return _allowances[owner][spender]; } /** * @dev See {IERC20-approve}. * * Requirements: * * - `spender` cannot be the zero address. */ function approve(address spender, uint256 amount) public virtual override returns (bool) { _approve(_msgSender(), spender, amount); return true; } /** * @dev See {IERC20-transferFrom}. * * Emits an {Approval} event indicating the updated allowance. This is not * required by the EIP. See the note at the beginning of {ERC20}. * * Requirements: * * - `sender` and `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. * - the caller must have allowance for ``sender``'s tokens of at least * `amount`. */ function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) { _transfer(sender, recipient, amount); uint256 currentAllowance = _allowances[sender][_msgSender()]; require(currentAllowance >= amount, "ERC20: transfer amount exceeds allowance"); _approve(sender, _msgSender(), currentAllowance - amount); return true; } /** * @dev Atomically increases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. */ function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender] + addedValue); return true; } /** * @dev Atomically decreases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. * - `spender` must have allowance for the caller of at least * `subtractedValue`. */ function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) { uint256 currentAllowance = _allowances[_msgSender()][spender]; require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero"); _approve(_msgSender(), spender, currentAllowance - subtractedValue); return true; } /** * @dev Moves tokens `amount` from `sender` to `recipient`. * * This is internal function is equivalent to {transfer}, and can be used to * e.g. implement automatic token fees, slashing mechanisms, etc. * * Emits a {Transfer} event. * * Requirements: * * - `sender` cannot be the zero address. * - `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. */ function _transfer(address sender, address recipient, uint256 amount) internal virtual { require(sender != address(0), "ERC20: transfer from the zero address"); require(recipient != address(0), "ERC20: transfer to the zero address"); _beforeTokenTransfer(sender, recipient, amount); uint256 senderBalance = _balances[sender]; require(senderBalance >= amount, "ERC20: transfer amount exceeds balance"); _balances[sender] = senderBalance - amount; _balances[recipient] += amount; emit Transfer(sender, recipient, amount); } /** @dev Creates `amount` tokens and assigns them to `account`, increasing * the total supply. * * Emits a {Transfer} event with `from` set to the zero address. * * Requirements: * * - `to` cannot be the zero address. */ function _mint(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: mint to the zero address"); _beforeTokenTransfer(address(0), account, amount); _totalSupply += amount; _balances[account] += amount; emit Transfer(address(0), account, amount); } /** * @dev Destroys `amount` tokens from `account`, reducing the * total supply. * * Emits a {Transfer} event with `to` set to the zero address. * * Requirements: * * - `account` cannot be the zero address. * - `account` must have at least `amount` tokens. */ function _burn(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: burn from the zero address"); _beforeTokenTransfer(account, address(0), amount); uint256 accountBalance = _balances[account]; require(accountBalance >= amount, "ERC20: burn amount exceeds balance"); _balances[account] = accountBalance - amount; _totalSupply -= amount; emit Transfer(account, address(0), amount); } /** * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens. * * This internal function is equivalent to `approve`, and can be used to * e.g. set automatic allowances for certain subsystems, etc. * * Emits an {Approval} event. * * Requirements: * * - `owner` cannot be the zero address. * - `spender` cannot be the zero address. */ function _approve(address owner, address spender, uint256 amount) internal virtual { require(owner != address(0), "ERC20: approve from the zero address"); require(spender != address(0), "ERC20: approve to the zero address"); _allowances[owner][spender] = amount; emit Approval(owner, spender, amount); } /** * @dev Hook that is called before any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens * will be to transferred to `to`. * - when `from` is zero, `amount` tokens will be minted for `to`. * - when `to` is zero, `amount` of ``from``'s tokens will be burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual { } }
/** * @dev Implementation of the {IERC20} interface. * * This implementation is agnostic to the way tokens are created. This means * that a supply mechanism has to be added in a derived contract using {_mint}. * For a generic mechanism see {ERC20PresetMinterPauser}. * * TIP: For a detailed writeup see our guide * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How * to implement supply mechanisms]. * * We have followed general OpenZeppelin guidelines: functions revert instead * of returning `false` on failure. This behavior is nonetheless conventional * and does not conflict with the expectations of ERC20 applications. * * Additionally, an {Approval} event is emitted on calls to {transferFrom}. * This allows applications to reconstruct the allowance for all accounts just * by listening to said events. Other implementations of the EIP may not emit * these events, as it isn't required by the specification. * * Finally, the non-standard {decreaseAllowance} and {increaseAllowance} * functions have been added to mitigate the well-known issues around setting * allowances. See {IERC20-approve}. */
NatSpecMultiLine
decimals
function decimals() public view virtual returns (uint8) { return 18; }
/** * @dev Returns the number of decimals used to get its user representation. * For example, if `decimals` equals `2`, a balance of `505` tokens should * be displayed to a user as `5,05` (`505 / 10 ** 2`). * * Tokens usually opt for a value of 18, imitating the relationship between * Ether and Wei. This is the value {ERC20} uses, unless this function is * overloaded; * * NOTE: This information is only used for _display_ purposes: it in * no way affects any of the arithmetic of the contract, including * {IERC20-balanceOf} and {IERC20-transfer}. */
NatSpecMultiLine
v0.8.1+commit.df193b15
MIT
ipfs://b5a9bf50d6ab20fb6187e0977c4859ef104592e8af65af586f892117edccd45a
{ "func_code_index": [ 1710, 1799 ] }
1,095
BCUG
BCUG.sol
0x14da7b27b2e0fedefe0a664118b0c9bc68e2e9af
Solidity
ERC20
contract ERC20 is Context, IERC20 { mapping (address => uint256) private _balances; mapping (address => mapping (address => uint256)) private _allowances; uint256 private _totalSupply; string private _name; string private _symbol; /** * @dev Sets the values for {name} and {symbol}. * * The default value of {decimals} is 18. To select a different value for * {decimals} you should overload it. * * All three of these values are immutable: they can only be set once during * construction. */ constructor (string memory name_, string memory symbol_) { _name = name_; _symbol = symbol_; } /** * @dev Returns the name of the token. */ function name() public view virtual returns (string memory) { return _name; } /** * @dev Returns the symbol of the token, usually a shorter version of the * name. */ function symbol() public view virtual returns (string memory) { return _symbol; } /** * @dev Returns the number of decimals used to get its user representation. * For example, if `decimals` equals `2`, a balance of `505` tokens should * be displayed to a user as `5,05` (`505 / 10 ** 2`). * * Tokens usually opt for a value of 18, imitating the relationship between * Ether and Wei. This is the value {ERC20} uses, unless this function is * overloaded; * * NOTE: This information is only used for _display_ purposes: it in * no way affects any of the arithmetic of the contract, including * {IERC20-balanceOf} and {IERC20-transfer}. */ function decimals() public view virtual returns (uint8) { return 18; } /** * @dev See {IERC20-totalSupply}. */ function totalSupply() public view virtual override returns (uint256) { return _totalSupply; } /** * @dev See {IERC20-balanceOf}. */ function balanceOf(address account) public view virtual override returns (uint256) { return _balances[account]; } /** * @dev See {IERC20-transfer}. * * Requirements: * * - `recipient` cannot be the zero address. * - the caller must have a balance of at least `amount`. */ function transfer(address recipient, uint256 amount) public virtual override returns (bool) { _transfer(_msgSender(), recipient, amount); return true; } /** * @dev See {IERC20-allowance}. */ function allowance(address owner, address spender) public view virtual override returns (uint256) { return _allowances[owner][spender]; } /** * @dev See {IERC20-approve}. * * Requirements: * * - `spender` cannot be the zero address. */ function approve(address spender, uint256 amount) public virtual override returns (bool) { _approve(_msgSender(), spender, amount); return true; } /** * @dev See {IERC20-transferFrom}. * * Emits an {Approval} event indicating the updated allowance. This is not * required by the EIP. See the note at the beginning of {ERC20}. * * Requirements: * * - `sender` and `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. * - the caller must have allowance for ``sender``'s tokens of at least * `amount`. */ function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) { _transfer(sender, recipient, amount); uint256 currentAllowance = _allowances[sender][_msgSender()]; require(currentAllowance >= amount, "ERC20: transfer amount exceeds allowance"); _approve(sender, _msgSender(), currentAllowance - amount); return true; } /** * @dev Atomically increases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. */ function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender] + addedValue); return true; } /** * @dev Atomically decreases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. * - `spender` must have allowance for the caller of at least * `subtractedValue`. */ function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) { uint256 currentAllowance = _allowances[_msgSender()][spender]; require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero"); _approve(_msgSender(), spender, currentAllowance - subtractedValue); return true; } /** * @dev Moves tokens `amount` from `sender` to `recipient`. * * This is internal function is equivalent to {transfer}, and can be used to * e.g. implement automatic token fees, slashing mechanisms, etc. * * Emits a {Transfer} event. * * Requirements: * * - `sender` cannot be the zero address. * - `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. */ function _transfer(address sender, address recipient, uint256 amount) internal virtual { require(sender != address(0), "ERC20: transfer from the zero address"); require(recipient != address(0), "ERC20: transfer to the zero address"); _beforeTokenTransfer(sender, recipient, amount); uint256 senderBalance = _balances[sender]; require(senderBalance >= amount, "ERC20: transfer amount exceeds balance"); _balances[sender] = senderBalance - amount; _balances[recipient] += amount; emit Transfer(sender, recipient, amount); } /** @dev Creates `amount` tokens and assigns them to `account`, increasing * the total supply. * * Emits a {Transfer} event with `from` set to the zero address. * * Requirements: * * - `to` cannot be the zero address. */ function _mint(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: mint to the zero address"); _beforeTokenTransfer(address(0), account, amount); _totalSupply += amount; _balances[account] += amount; emit Transfer(address(0), account, amount); } /** * @dev Destroys `amount` tokens from `account`, reducing the * total supply. * * Emits a {Transfer} event with `to` set to the zero address. * * Requirements: * * - `account` cannot be the zero address. * - `account` must have at least `amount` tokens. */ function _burn(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: burn from the zero address"); _beforeTokenTransfer(account, address(0), amount); uint256 accountBalance = _balances[account]; require(accountBalance >= amount, "ERC20: burn amount exceeds balance"); _balances[account] = accountBalance - amount; _totalSupply -= amount; emit Transfer(account, address(0), amount); } /** * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens. * * This internal function is equivalent to `approve`, and can be used to * e.g. set automatic allowances for certain subsystems, etc. * * Emits an {Approval} event. * * Requirements: * * - `owner` cannot be the zero address. * - `spender` cannot be the zero address. */ function _approve(address owner, address spender, uint256 amount) internal virtual { require(owner != address(0), "ERC20: approve from the zero address"); require(spender != address(0), "ERC20: approve to the zero address"); _allowances[owner][spender] = amount; emit Approval(owner, spender, amount); } /** * @dev Hook that is called before any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens * will be to transferred to `to`. * - when `from` is zero, `amount` tokens will be minted for `to`. * - when `to` is zero, `amount` of ``from``'s tokens will be burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual { } }
/** * @dev Implementation of the {IERC20} interface. * * This implementation is agnostic to the way tokens are created. This means * that a supply mechanism has to be added in a derived contract using {_mint}. * For a generic mechanism see {ERC20PresetMinterPauser}. * * TIP: For a detailed writeup see our guide * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How * to implement supply mechanisms]. * * We have followed general OpenZeppelin guidelines: functions revert instead * of returning `false` on failure. This behavior is nonetheless conventional * and does not conflict with the expectations of ERC20 applications. * * Additionally, an {Approval} event is emitted on calls to {transferFrom}. * This allows applications to reconstruct the allowance for all accounts just * by listening to said events. Other implementations of the EIP may not emit * these events, as it isn't required by the specification. * * Finally, the non-standard {decreaseAllowance} and {increaseAllowance} * functions have been added to mitigate the well-known issues around setting * allowances. See {IERC20-approve}. */
NatSpecMultiLine
totalSupply
function totalSupply() public view virtual override returns (uint256) { return _totalSupply; }
/** * @dev See {IERC20-totalSupply}. */
NatSpecMultiLine
v0.8.1+commit.df193b15
MIT
ipfs://b5a9bf50d6ab20fb6187e0977c4859ef104592e8af65af586f892117edccd45a
{ "func_code_index": [ 1859, 1972 ] }
1,096
BCUG
BCUG.sol
0x14da7b27b2e0fedefe0a664118b0c9bc68e2e9af
Solidity
ERC20
contract ERC20 is Context, IERC20 { mapping (address => uint256) private _balances; mapping (address => mapping (address => uint256)) private _allowances; uint256 private _totalSupply; string private _name; string private _symbol; /** * @dev Sets the values for {name} and {symbol}. * * The default value of {decimals} is 18. To select a different value for * {decimals} you should overload it. * * All three of these values are immutable: they can only be set once during * construction. */ constructor (string memory name_, string memory symbol_) { _name = name_; _symbol = symbol_; } /** * @dev Returns the name of the token. */ function name() public view virtual returns (string memory) { return _name; } /** * @dev Returns the symbol of the token, usually a shorter version of the * name. */ function symbol() public view virtual returns (string memory) { return _symbol; } /** * @dev Returns the number of decimals used to get its user representation. * For example, if `decimals` equals `2`, a balance of `505` tokens should * be displayed to a user as `5,05` (`505 / 10 ** 2`). * * Tokens usually opt for a value of 18, imitating the relationship between * Ether and Wei. This is the value {ERC20} uses, unless this function is * overloaded; * * NOTE: This information is only used for _display_ purposes: it in * no way affects any of the arithmetic of the contract, including * {IERC20-balanceOf} and {IERC20-transfer}. */ function decimals() public view virtual returns (uint8) { return 18; } /** * @dev See {IERC20-totalSupply}. */ function totalSupply() public view virtual override returns (uint256) { return _totalSupply; } /** * @dev See {IERC20-balanceOf}. */ function balanceOf(address account) public view virtual override returns (uint256) { return _balances[account]; } /** * @dev See {IERC20-transfer}. * * Requirements: * * - `recipient` cannot be the zero address. * - the caller must have a balance of at least `amount`. */ function transfer(address recipient, uint256 amount) public virtual override returns (bool) { _transfer(_msgSender(), recipient, amount); return true; } /** * @dev See {IERC20-allowance}. */ function allowance(address owner, address spender) public view virtual override returns (uint256) { return _allowances[owner][spender]; } /** * @dev See {IERC20-approve}. * * Requirements: * * - `spender` cannot be the zero address. */ function approve(address spender, uint256 amount) public virtual override returns (bool) { _approve(_msgSender(), spender, amount); return true; } /** * @dev See {IERC20-transferFrom}. * * Emits an {Approval} event indicating the updated allowance. This is not * required by the EIP. See the note at the beginning of {ERC20}. * * Requirements: * * - `sender` and `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. * - the caller must have allowance for ``sender``'s tokens of at least * `amount`. */ function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) { _transfer(sender, recipient, amount); uint256 currentAllowance = _allowances[sender][_msgSender()]; require(currentAllowance >= amount, "ERC20: transfer amount exceeds allowance"); _approve(sender, _msgSender(), currentAllowance - amount); return true; } /** * @dev Atomically increases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. */ function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender] + addedValue); return true; } /** * @dev Atomically decreases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. * - `spender` must have allowance for the caller of at least * `subtractedValue`. */ function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) { uint256 currentAllowance = _allowances[_msgSender()][spender]; require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero"); _approve(_msgSender(), spender, currentAllowance - subtractedValue); return true; } /** * @dev Moves tokens `amount` from `sender` to `recipient`. * * This is internal function is equivalent to {transfer}, and can be used to * e.g. implement automatic token fees, slashing mechanisms, etc. * * Emits a {Transfer} event. * * Requirements: * * - `sender` cannot be the zero address. * - `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. */ function _transfer(address sender, address recipient, uint256 amount) internal virtual { require(sender != address(0), "ERC20: transfer from the zero address"); require(recipient != address(0), "ERC20: transfer to the zero address"); _beforeTokenTransfer(sender, recipient, amount); uint256 senderBalance = _balances[sender]; require(senderBalance >= amount, "ERC20: transfer amount exceeds balance"); _balances[sender] = senderBalance - amount; _balances[recipient] += amount; emit Transfer(sender, recipient, amount); } /** @dev Creates `amount` tokens and assigns them to `account`, increasing * the total supply. * * Emits a {Transfer} event with `from` set to the zero address. * * Requirements: * * - `to` cannot be the zero address. */ function _mint(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: mint to the zero address"); _beforeTokenTransfer(address(0), account, amount); _totalSupply += amount; _balances[account] += amount; emit Transfer(address(0), account, amount); } /** * @dev Destroys `amount` tokens from `account`, reducing the * total supply. * * Emits a {Transfer} event with `to` set to the zero address. * * Requirements: * * - `account` cannot be the zero address. * - `account` must have at least `amount` tokens. */ function _burn(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: burn from the zero address"); _beforeTokenTransfer(account, address(0), amount); uint256 accountBalance = _balances[account]; require(accountBalance >= amount, "ERC20: burn amount exceeds balance"); _balances[account] = accountBalance - amount; _totalSupply -= amount; emit Transfer(account, address(0), amount); } /** * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens. * * This internal function is equivalent to `approve`, and can be used to * e.g. set automatic allowances for certain subsystems, etc. * * Emits an {Approval} event. * * Requirements: * * - `owner` cannot be the zero address. * - `spender` cannot be the zero address. */ function _approve(address owner, address spender, uint256 amount) internal virtual { require(owner != address(0), "ERC20: approve from the zero address"); require(spender != address(0), "ERC20: approve to the zero address"); _allowances[owner][spender] = amount; emit Approval(owner, spender, amount); } /** * @dev Hook that is called before any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens * will be to transferred to `to`. * - when `from` is zero, `amount` tokens will be minted for `to`. * - when `to` is zero, `amount` of ``from``'s tokens will be burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual { } }
/** * @dev Implementation of the {IERC20} interface. * * This implementation is agnostic to the way tokens are created. This means * that a supply mechanism has to be added in a derived contract using {_mint}. * For a generic mechanism see {ERC20PresetMinterPauser}. * * TIP: For a detailed writeup see our guide * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How * to implement supply mechanisms]. * * We have followed general OpenZeppelin guidelines: functions revert instead * of returning `false` on failure. This behavior is nonetheless conventional * and does not conflict with the expectations of ERC20 applications. * * Additionally, an {Approval} event is emitted on calls to {transferFrom}. * This allows applications to reconstruct the allowance for all accounts just * by listening to said events. Other implementations of the EIP may not emit * these events, as it isn't required by the specification. * * Finally, the non-standard {decreaseAllowance} and {increaseAllowance} * functions have been added to mitigate the well-known issues around setting * allowances. See {IERC20-approve}. */
NatSpecMultiLine
balanceOf
function balanceOf(address account) public view virtual override returns (uint256) { return _balances[account]; }
/** * @dev See {IERC20-balanceOf}. */
NatSpecMultiLine
v0.8.1+commit.df193b15
MIT
ipfs://b5a9bf50d6ab20fb6187e0977c4859ef104592e8af65af586f892117edccd45a
{ "func_code_index": [ 2030, 2162 ] }
1,097
BCUG
BCUG.sol
0x14da7b27b2e0fedefe0a664118b0c9bc68e2e9af
Solidity
ERC20
contract ERC20 is Context, IERC20 { mapping (address => uint256) private _balances; mapping (address => mapping (address => uint256)) private _allowances; uint256 private _totalSupply; string private _name; string private _symbol; /** * @dev Sets the values for {name} and {symbol}. * * The default value of {decimals} is 18. To select a different value for * {decimals} you should overload it. * * All three of these values are immutable: they can only be set once during * construction. */ constructor (string memory name_, string memory symbol_) { _name = name_; _symbol = symbol_; } /** * @dev Returns the name of the token. */ function name() public view virtual returns (string memory) { return _name; } /** * @dev Returns the symbol of the token, usually a shorter version of the * name. */ function symbol() public view virtual returns (string memory) { return _symbol; } /** * @dev Returns the number of decimals used to get its user representation. * For example, if `decimals` equals `2`, a balance of `505` tokens should * be displayed to a user as `5,05` (`505 / 10 ** 2`). * * Tokens usually opt for a value of 18, imitating the relationship between * Ether and Wei. This is the value {ERC20} uses, unless this function is * overloaded; * * NOTE: This information is only used for _display_ purposes: it in * no way affects any of the arithmetic of the contract, including * {IERC20-balanceOf} and {IERC20-transfer}. */ function decimals() public view virtual returns (uint8) { return 18; } /** * @dev See {IERC20-totalSupply}. */ function totalSupply() public view virtual override returns (uint256) { return _totalSupply; } /** * @dev See {IERC20-balanceOf}. */ function balanceOf(address account) public view virtual override returns (uint256) { return _balances[account]; } /** * @dev See {IERC20-transfer}. * * Requirements: * * - `recipient` cannot be the zero address. * - the caller must have a balance of at least `amount`. */ function transfer(address recipient, uint256 amount) public virtual override returns (bool) { _transfer(_msgSender(), recipient, amount); return true; } /** * @dev See {IERC20-allowance}. */ function allowance(address owner, address spender) public view virtual override returns (uint256) { return _allowances[owner][spender]; } /** * @dev See {IERC20-approve}. * * Requirements: * * - `spender` cannot be the zero address. */ function approve(address spender, uint256 amount) public virtual override returns (bool) { _approve(_msgSender(), spender, amount); return true; } /** * @dev See {IERC20-transferFrom}. * * Emits an {Approval} event indicating the updated allowance. This is not * required by the EIP. See the note at the beginning of {ERC20}. * * Requirements: * * - `sender` and `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. * - the caller must have allowance for ``sender``'s tokens of at least * `amount`. */ function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) { _transfer(sender, recipient, amount); uint256 currentAllowance = _allowances[sender][_msgSender()]; require(currentAllowance >= amount, "ERC20: transfer amount exceeds allowance"); _approve(sender, _msgSender(), currentAllowance - amount); return true; } /** * @dev Atomically increases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. */ function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender] + addedValue); return true; } /** * @dev Atomically decreases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. * - `spender` must have allowance for the caller of at least * `subtractedValue`. */ function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) { uint256 currentAllowance = _allowances[_msgSender()][spender]; require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero"); _approve(_msgSender(), spender, currentAllowance - subtractedValue); return true; } /** * @dev Moves tokens `amount` from `sender` to `recipient`. * * This is internal function is equivalent to {transfer}, and can be used to * e.g. implement automatic token fees, slashing mechanisms, etc. * * Emits a {Transfer} event. * * Requirements: * * - `sender` cannot be the zero address. * - `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. */ function _transfer(address sender, address recipient, uint256 amount) internal virtual { require(sender != address(0), "ERC20: transfer from the zero address"); require(recipient != address(0), "ERC20: transfer to the zero address"); _beforeTokenTransfer(sender, recipient, amount); uint256 senderBalance = _balances[sender]; require(senderBalance >= amount, "ERC20: transfer amount exceeds balance"); _balances[sender] = senderBalance - amount; _balances[recipient] += amount; emit Transfer(sender, recipient, amount); } /** @dev Creates `amount` tokens and assigns them to `account`, increasing * the total supply. * * Emits a {Transfer} event with `from` set to the zero address. * * Requirements: * * - `to` cannot be the zero address. */ function _mint(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: mint to the zero address"); _beforeTokenTransfer(address(0), account, amount); _totalSupply += amount; _balances[account] += amount; emit Transfer(address(0), account, amount); } /** * @dev Destroys `amount` tokens from `account`, reducing the * total supply. * * Emits a {Transfer} event with `to` set to the zero address. * * Requirements: * * - `account` cannot be the zero address. * - `account` must have at least `amount` tokens. */ function _burn(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: burn from the zero address"); _beforeTokenTransfer(account, address(0), amount); uint256 accountBalance = _balances[account]; require(accountBalance >= amount, "ERC20: burn amount exceeds balance"); _balances[account] = accountBalance - amount; _totalSupply -= amount; emit Transfer(account, address(0), amount); } /** * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens. * * This internal function is equivalent to `approve`, and can be used to * e.g. set automatic allowances for certain subsystems, etc. * * Emits an {Approval} event. * * Requirements: * * - `owner` cannot be the zero address. * - `spender` cannot be the zero address. */ function _approve(address owner, address spender, uint256 amount) internal virtual { require(owner != address(0), "ERC20: approve from the zero address"); require(spender != address(0), "ERC20: approve to the zero address"); _allowances[owner][spender] = amount; emit Approval(owner, spender, amount); } /** * @dev Hook that is called before any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens * will be to transferred to `to`. * - when `from` is zero, `amount` tokens will be minted for `to`. * - when `to` is zero, `amount` of ``from``'s tokens will be burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual { } }
/** * @dev Implementation of the {IERC20} interface. * * This implementation is agnostic to the way tokens are created. This means * that a supply mechanism has to be added in a derived contract using {_mint}. * For a generic mechanism see {ERC20PresetMinterPauser}. * * TIP: For a detailed writeup see our guide * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How * to implement supply mechanisms]. * * We have followed general OpenZeppelin guidelines: functions revert instead * of returning `false` on failure. This behavior is nonetheless conventional * and does not conflict with the expectations of ERC20 applications. * * Additionally, an {Approval} event is emitted on calls to {transferFrom}. * This allows applications to reconstruct the allowance for all accounts just * by listening to said events. Other implementations of the EIP may not emit * these events, as it isn't required by the specification. * * Finally, the non-standard {decreaseAllowance} and {increaseAllowance} * functions have been added to mitigate the well-known issues around setting * allowances. See {IERC20-approve}. */
NatSpecMultiLine
transfer
function transfer(address recipient, uint256 amount) public virtual override returns (bool) { _transfer(_msgSender(), recipient, amount); return true; }
/** * @dev See {IERC20-transfer}. * * Requirements: * * - `recipient` cannot be the zero address. * - the caller must have a balance of at least `amount`. */
NatSpecMultiLine
v0.8.1+commit.df193b15
MIT
ipfs://b5a9bf50d6ab20fb6187e0977c4859ef104592e8af65af586f892117edccd45a
{ "func_code_index": [ 2370, 2550 ] }
1,098
BCUG
BCUG.sol
0x14da7b27b2e0fedefe0a664118b0c9bc68e2e9af
Solidity
ERC20
contract ERC20 is Context, IERC20 { mapping (address => uint256) private _balances; mapping (address => mapping (address => uint256)) private _allowances; uint256 private _totalSupply; string private _name; string private _symbol; /** * @dev Sets the values for {name} and {symbol}. * * The default value of {decimals} is 18. To select a different value for * {decimals} you should overload it. * * All three of these values are immutable: they can only be set once during * construction. */ constructor (string memory name_, string memory symbol_) { _name = name_; _symbol = symbol_; } /** * @dev Returns the name of the token. */ function name() public view virtual returns (string memory) { return _name; } /** * @dev Returns the symbol of the token, usually a shorter version of the * name. */ function symbol() public view virtual returns (string memory) { return _symbol; } /** * @dev Returns the number of decimals used to get its user representation. * For example, if `decimals` equals `2`, a balance of `505` tokens should * be displayed to a user as `5,05` (`505 / 10 ** 2`). * * Tokens usually opt for a value of 18, imitating the relationship between * Ether and Wei. This is the value {ERC20} uses, unless this function is * overloaded; * * NOTE: This information is only used for _display_ purposes: it in * no way affects any of the arithmetic of the contract, including * {IERC20-balanceOf} and {IERC20-transfer}. */ function decimals() public view virtual returns (uint8) { return 18; } /** * @dev See {IERC20-totalSupply}. */ function totalSupply() public view virtual override returns (uint256) { return _totalSupply; } /** * @dev See {IERC20-balanceOf}. */ function balanceOf(address account) public view virtual override returns (uint256) { return _balances[account]; } /** * @dev See {IERC20-transfer}. * * Requirements: * * - `recipient` cannot be the zero address. * - the caller must have a balance of at least `amount`. */ function transfer(address recipient, uint256 amount) public virtual override returns (bool) { _transfer(_msgSender(), recipient, amount); return true; } /** * @dev See {IERC20-allowance}. */ function allowance(address owner, address spender) public view virtual override returns (uint256) { return _allowances[owner][spender]; } /** * @dev See {IERC20-approve}. * * Requirements: * * - `spender` cannot be the zero address. */ function approve(address spender, uint256 amount) public virtual override returns (bool) { _approve(_msgSender(), spender, amount); return true; } /** * @dev See {IERC20-transferFrom}. * * Emits an {Approval} event indicating the updated allowance. This is not * required by the EIP. See the note at the beginning of {ERC20}. * * Requirements: * * - `sender` and `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. * - the caller must have allowance for ``sender``'s tokens of at least * `amount`. */ function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) { _transfer(sender, recipient, amount); uint256 currentAllowance = _allowances[sender][_msgSender()]; require(currentAllowance >= amount, "ERC20: transfer amount exceeds allowance"); _approve(sender, _msgSender(), currentAllowance - amount); return true; } /** * @dev Atomically increases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. */ function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender] + addedValue); return true; } /** * @dev Atomically decreases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. * - `spender` must have allowance for the caller of at least * `subtractedValue`. */ function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) { uint256 currentAllowance = _allowances[_msgSender()][spender]; require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero"); _approve(_msgSender(), spender, currentAllowance - subtractedValue); return true; } /** * @dev Moves tokens `amount` from `sender` to `recipient`. * * This is internal function is equivalent to {transfer}, and can be used to * e.g. implement automatic token fees, slashing mechanisms, etc. * * Emits a {Transfer} event. * * Requirements: * * - `sender` cannot be the zero address. * - `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. */ function _transfer(address sender, address recipient, uint256 amount) internal virtual { require(sender != address(0), "ERC20: transfer from the zero address"); require(recipient != address(0), "ERC20: transfer to the zero address"); _beforeTokenTransfer(sender, recipient, amount); uint256 senderBalance = _balances[sender]; require(senderBalance >= amount, "ERC20: transfer amount exceeds balance"); _balances[sender] = senderBalance - amount; _balances[recipient] += amount; emit Transfer(sender, recipient, amount); } /** @dev Creates `amount` tokens and assigns them to `account`, increasing * the total supply. * * Emits a {Transfer} event with `from` set to the zero address. * * Requirements: * * - `to` cannot be the zero address. */ function _mint(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: mint to the zero address"); _beforeTokenTransfer(address(0), account, amount); _totalSupply += amount; _balances[account] += amount; emit Transfer(address(0), account, amount); } /** * @dev Destroys `amount` tokens from `account`, reducing the * total supply. * * Emits a {Transfer} event with `to` set to the zero address. * * Requirements: * * - `account` cannot be the zero address. * - `account` must have at least `amount` tokens. */ function _burn(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: burn from the zero address"); _beforeTokenTransfer(account, address(0), amount); uint256 accountBalance = _balances[account]; require(accountBalance >= amount, "ERC20: burn amount exceeds balance"); _balances[account] = accountBalance - amount; _totalSupply -= amount; emit Transfer(account, address(0), amount); } /** * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens. * * This internal function is equivalent to `approve`, and can be used to * e.g. set automatic allowances for certain subsystems, etc. * * Emits an {Approval} event. * * Requirements: * * - `owner` cannot be the zero address. * - `spender` cannot be the zero address. */ function _approve(address owner, address spender, uint256 amount) internal virtual { require(owner != address(0), "ERC20: approve from the zero address"); require(spender != address(0), "ERC20: approve to the zero address"); _allowances[owner][spender] = amount; emit Approval(owner, spender, amount); } /** * @dev Hook that is called before any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens * will be to transferred to `to`. * - when `from` is zero, `amount` tokens will be minted for `to`. * - when `to` is zero, `amount` of ``from``'s tokens will be burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual { } }
/** * @dev Implementation of the {IERC20} interface. * * This implementation is agnostic to the way tokens are created. This means * that a supply mechanism has to be added in a derived contract using {_mint}. * For a generic mechanism see {ERC20PresetMinterPauser}. * * TIP: For a detailed writeup see our guide * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How * to implement supply mechanisms]. * * We have followed general OpenZeppelin guidelines: functions revert instead * of returning `false` on failure. This behavior is nonetheless conventional * and does not conflict with the expectations of ERC20 applications. * * Additionally, an {Approval} event is emitted on calls to {transferFrom}. * This allows applications to reconstruct the allowance for all accounts just * by listening to said events. Other implementations of the EIP may not emit * these events, as it isn't required by the specification. * * Finally, the non-standard {decreaseAllowance} and {increaseAllowance} * functions have been added to mitigate the well-known issues around setting * allowances. See {IERC20-approve}. */
NatSpecMultiLine
allowance
function allowance(address owner, address spender) public view virtual override returns (uint256) { return _allowances[owner][spender]; }
/** * @dev See {IERC20-allowance}. */
NatSpecMultiLine
v0.8.1+commit.df193b15
MIT
ipfs://b5a9bf50d6ab20fb6187e0977c4859ef104592e8af65af586f892117edccd45a
{ "func_code_index": [ 2608, 2764 ] }
1,099
BCUG
BCUG.sol
0x14da7b27b2e0fedefe0a664118b0c9bc68e2e9af
Solidity
ERC20
contract ERC20 is Context, IERC20 { mapping (address => uint256) private _balances; mapping (address => mapping (address => uint256)) private _allowances; uint256 private _totalSupply; string private _name; string private _symbol; /** * @dev Sets the values for {name} and {symbol}. * * The default value of {decimals} is 18. To select a different value for * {decimals} you should overload it. * * All three of these values are immutable: they can only be set once during * construction. */ constructor (string memory name_, string memory symbol_) { _name = name_; _symbol = symbol_; } /** * @dev Returns the name of the token. */ function name() public view virtual returns (string memory) { return _name; } /** * @dev Returns the symbol of the token, usually a shorter version of the * name. */ function symbol() public view virtual returns (string memory) { return _symbol; } /** * @dev Returns the number of decimals used to get its user representation. * For example, if `decimals` equals `2`, a balance of `505` tokens should * be displayed to a user as `5,05` (`505 / 10 ** 2`). * * Tokens usually opt for a value of 18, imitating the relationship between * Ether and Wei. This is the value {ERC20} uses, unless this function is * overloaded; * * NOTE: This information is only used for _display_ purposes: it in * no way affects any of the arithmetic of the contract, including * {IERC20-balanceOf} and {IERC20-transfer}. */ function decimals() public view virtual returns (uint8) { return 18; } /** * @dev See {IERC20-totalSupply}. */ function totalSupply() public view virtual override returns (uint256) { return _totalSupply; } /** * @dev See {IERC20-balanceOf}. */ function balanceOf(address account) public view virtual override returns (uint256) { return _balances[account]; } /** * @dev See {IERC20-transfer}. * * Requirements: * * - `recipient` cannot be the zero address. * - the caller must have a balance of at least `amount`. */ function transfer(address recipient, uint256 amount) public virtual override returns (bool) { _transfer(_msgSender(), recipient, amount); return true; } /** * @dev See {IERC20-allowance}. */ function allowance(address owner, address spender) public view virtual override returns (uint256) { return _allowances[owner][spender]; } /** * @dev See {IERC20-approve}. * * Requirements: * * - `spender` cannot be the zero address. */ function approve(address spender, uint256 amount) public virtual override returns (bool) { _approve(_msgSender(), spender, amount); return true; } /** * @dev See {IERC20-transferFrom}. * * Emits an {Approval} event indicating the updated allowance. This is not * required by the EIP. See the note at the beginning of {ERC20}. * * Requirements: * * - `sender` and `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. * - the caller must have allowance for ``sender``'s tokens of at least * `amount`. */ function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) { _transfer(sender, recipient, amount); uint256 currentAllowance = _allowances[sender][_msgSender()]; require(currentAllowance >= amount, "ERC20: transfer amount exceeds allowance"); _approve(sender, _msgSender(), currentAllowance - amount); return true; } /** * @dev Atomically increases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. */ function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender] + addedValue); return true; } /** * @dev Atomically decreases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. * - `spender` must have allowance for the caller of at least * `subtractedValue`. */ function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) { uint256 currentAllowance = _allowances[_msgSender()][spender]; require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero"); _approve(_msgSender(), spender, currentAllowance - subtractedValue); return true; } /** * @dev Moves tokens `amount` from `sender` to `recipient`. * * This is internal function is equivalent to {transfer}, and can be used to * e.g. implement automatic token fees, slashing mechanisms, etc. * * Emits a {Transfer} event. * * Requirements: * * - `sender` cannot be the zero address. * - `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. */ function _transfer(address sender, address recipient, uint256 amount) internal virtual { require(sender != address(0), "ERC20: transfer from the zero address"); require(recipient != address(0), "ERC20: transfer to the zero address"); _beforeTokenTransfer(sender, recipient, amount); uint256 senderBalance = _balances[sender]; require(senderBalance >= amount, "ERC20: transfer amount exceeds balance"); _balances[sender] = senderBalance - amount; _balances[recipient] += amount; emit Transfer(sender, recipient, amount); } /** @dev Creates `amount` tokens and assigns them to `account`, increasing * the total supply. * * Emits a {Transfer} event with `from` set to the zero address. * * Requirements: * * - `to` cannot be the zero address. */ function _mint(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: mint to the zero address"); _beforeTokenTransfer(address(0), account, amount); _totalSupply += amount; _balances[account] += amount; emit Transfer(address(0), account, amount); } /** * @dev Destroys `amount` tokens from `account`, reducing the * total supply. * * Emits a {Transfer} event with `to` set to the zero address. * * Requirements: * * - `account` cannot be the zero address. * - `account` must have at least `amount` tokens. */ function _burn(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: burn from the zero address"); _beforeTokenTransfer(account, address(0), amount); uint256 accountBalance = _balances[account]; require(accountBalance >= amount, "ERC20: burn amount exceeds balance"); _balances[account] = accountBalance - amount; _totalSupply -= amount; emit Transfer(account, address(0), amount); } /** * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens. * * This internal function is equivalent to `approve`, and can be used to * e.g. set automatic allowances for certain subsystems, etc. * * Emits an {Approval} event. * * Requirements: * * - `owner` cannot be the zero address. * - `spender` cannot be the zero address. */ function _approve(address owner, address spender, uint256 amount) internal virtual { require(owner != address(0), "ERC20: approve from the zero address"); require(spender != address(0), "ERC20: approve to the zero address"); _allowances[owner][spender] = amount; emit Approval(owner, spender, amount); } /** * @dev Hook that is called before any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens * will be to transferred to `to`. * - when `from` is zero, `amount` tokens will be minted for `to`. * - when `to` is zero, `amount` of ``from``'s tokens will be burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual { } }
/** * @dev Implementation of the {IERC20} interface. * * This implementation is agnostic to the way tokens are created. This means * that a supply mechanism has to be added in a derived contract using {_mint}. * For a generic mechanism see {ERC20PresetMinterPauser}. * * TIP: For a detailed writeup see our guide * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How * to implement supply mechanisms]. * * We have followed general OpenZeppelin guidelines: functions revert instead * of returning `false` on failure. This behavior is nonetheless conventional * and does not conflict with the expectations of ERC20 applications. * * Additionally, an {Approval} event is emitted on calls to {transferFrom}. * This allows applications to reconstruct the allowance for all accounts just * by listening to said events. Other implementations of the EIP may not emit * these events, as it isn't required by the specification. * * Finally, the non-standard {decreaseAllowance} and {increaseAllowance} * functions have been added to mitigate the well-known issues around setting * allowances. See {IERC20-approve}. */
NatSpecMultiLine
approve
function approve(address spender, uint256 amount) public virtual override returns (bool) { _approve(_msgSender(), spender, amount); return true; }
/** * @dev See {IERC20-approve}. * * Requirements: * * - `spender` cannot be the zero address. */
NatSpecMultiLine
v0.8.1+commit.df193b15
MIT
ipfs://b5a9bf50d6ab20fb6187e0977c4859ef104592e8af65af586f892117edccd45a
{ "func_code_index": [ 2906, 3080 ] }
1,100
BCUG
BCUG.sol
0x14da7b27b2e0fedefe0a664118b0c9bc68e2e9af
Solidity
ERC20
contract ERC20 is Context, IERC20 { mapping (address => uint256) private _balances; mapping (address => mapping (address => uint256)) private _allowances; uint256 private _totalSupply; string private _name; string private _symbol; /** * @dev Sets the values for {name} and {symbol}. * * The default value of {decimals} is 18. To select a different value for * {decimals} you should overload it. * * All three of these values are immutable: they can only be set once during * construction. */ constructor (string memory name_, string memory symbol_) { _name = name_; _symbol = symbol_; } /** * @dev Returns the name of the token. */ function name() public view virtual returns (string memory) { return _name; } /** * @dev Returns the symbol of the token, usually a shorter version of the * name. */ function symbol() public view virtual returns (string memory) { return _symbol; } /** * @dev Returns the number of decimals used to get its user representation. * For example, if `decimals` equals `2`, a balance of `505` tokens should * be displayed to a user as `5,05` (`505 / 10 ** 2`). * * Tokens usually opt for a value of 18, imitating the relationship between * Ether and Wei. This is the value {ERC20} uses, unless this function is * overloaded; * * NOTE: This information is only used for _display_ purposes: it in * no way affects any of the arithmetic of the contract, including * {IERC20-balanceOf} and {IERC20-transfer}. */ function decimals() public view virtual returns (uint8) { return 18; } /** * @dev See {IERC20-totalSupply}. */ function totalSupply() public view virtual override returns (uint256) { return _totalSupply; } /** * @dev See {IERC20-balanceOf}. */ function balanceOf(address account) public view virtual override returns (uint256) { return _balances[account]; } /** * @dev See {IERC20-transfer}. * * Requirements: * * - `recipient` cannot be the zero address. * - the caller must have a balance of at least `amount`. */ function transfer(address recipient, uint256 amount) public virtual override returns (bool) { _transfer(_msgSender(), recipient, amount); return true; } /** * @dev See {IERC20-allowance}. */ function allowance(address owner, address spender) public view virtual override returns (uint256) { return _allowances[owner][spender]; } /** * @dev See {IERC20-approve}. * * Requirements: * * - `spender` cannot be the zero address. */ function approve(address spender, uint256 amount) public virtual override returns (bool) { _approve(_msgSender(), spender, amount); return true; } /** * @dev See {IERC20-transferFrom}. * * Emits an {Approval} event indicating the updated allowance. This is not * required by the EIP. See the note at the beginning of {ERC20}. * * Requirements: * * - `sender` and `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. * - the caller must have allowance for ``sender``'s tokens of at least * `amount`. */ function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) { _transfer(sender, recipient, amount); uint256 currentAllowance = _allowances[sender][_msgSender()]; require(currentAllowance >= amount, "ERC20: transfer amount exceeds allowance"); _approve(sender, _msgSender(), currentAllowance - amount); return true; } /** * @dev Atomically increases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. */ function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender] + addedValue); return true; } /** * @dev Atomically decreases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. * - `spender` must have allowance for the caller of at least * `subtractedValue`. */ function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) { uint256 currentAllowance = _allowances[_msgSender()][spender]; require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero"); _approve(_msgSender(), spender, currentAllowance - subtractedValue); return true; } /** * @dev Moves tokens `amount` from `sender` to `recipient`. * * This is internal function is equivalent to {transfer}, and can be used to * e.g. implement automatic token fees, slashing mechanisms, etc. * * Emits a {Transfer} event. * * Requirements: * * - `sender` cannot be the zero address. * - `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. */ function _transfer(address sender, address recipient, uint256 amount) internal virtual { require(sender != address(0), "ERC20: transfer from the zero address"); require(recipient != address(0), "ERC20: transfer to the zero address"); _beforeTokenTransfer(sender, recipient, amount); uint256 senderBalance = _balances[sender]; require(senderBalance >= amount, "ERC20: transfer amount exceeds balance"); _balances[sender] = senderBalance - amount; _balances[recipient] += amount; emit Transfer(sender, recipient, amount); } /** @dev Creates `amount` tokens and assigns them to `account`, increasing * the total supply. * * Emits a {Transfer} event with `from` set to the zero address. * * Requirements: * * - `to` cannot be the zero address. */ function _mint(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: mint to the zero address"); _beforeTokenTransfer(address(0), account, amount); _totalSupply += amount; _balances[account] += amount; emit Transfer(address(0), account, amount); } /** * @dev Destroys `amount` tokens from `account`, reducing the * total supply. * * Emits a {Transfer} event with `to` set to the zero address. * * Requirements: * * - `account` cannot be the zero address. * - `account` must have at least `amount` tokens. */ function _burn(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: burn from the zero address"); _beforeTokenTransfer(account, address(0), amount); uint256 accountBalance = _balances[account]; require(accountBalance >= amount, "ERC20: burn amount exceeds balance"); _balances[account] = accountBalance - amount; _totalSupply -= amount; emit Transfer(account, address(0), amount); } /** * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens. * * This internal function is equivalent to `approve`, and can be used to * e.g. set automatic allowances for certain subsystems, etc. * * Emits an {Approval} event. * * Requirements: * * - `owner` cannot be the zero address. * - `spender` cannot be the zero address. */ function _approve(address owner, address spender, uint256 amount) internal virtual { require(owner != address(0), "ERC20: approve from the zero address"); require(spender != address(0), "ERC20: approve to the zero address"); _allowances[owner][spender] = amount; emit Approval(owner, spender, amount); } /** * @dev Hook that is called before any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens * will be to transferred to `to`. * - when `from` is zero, `amount` tokens will be minted for `to`. * - when `to` is zero, `amount` of ``from``'s tokens will be burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual { } }
/** * @dev Implementation of the {IERC20} interface. * * This implementation is agnostic to the way tokens are created. This means * that a supply mechanism has to be added in a derived contract using {_mint}. * For a generic mechanism see {ERC20PresetMinterPauser}. * * TIP: For a detailed writeup see our guide * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How * to implement supply mechanisms]. * * We have followed general OpenZeppelin guidelines: functions revert instead * of returning `false` on failure. This behavior is nonetheless conventional * and does not conflict with the expectations of ERC20 applications. * * Additionally, an {Approval} event is emitted on calls to {transferFrom}. * This allows applications to reconstruct the allowance for all accounts just * by listening to said events. Other implementations of the EIP may not emit * these events, as it isn't required by the specification. * * Finally, the non-standard {decreaseAllowance} and {increaseAllowance} * functions have been added to mitigate the well-known issues around setting * allowances. See {IERC20-approve}. */
NatSpecMultiLine
transferFrom
function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) { _transfer(sender, recipient, amount); uint256 currentAllowance = _allowances[sender][_msgSender()]; require(currentAllowance >= amount, "ERC20: transfer amount exceeds allowance"); _approve(sender, _msgSender(), currentAllowance - amount); return true; }
/** * @dev See {IERC20-transferFrom}. * * Emits an {Approval} event indicating the updated allowance. This is not * required by the EIP. See the note at the beginning of {ERC20}. * * Requirements: * * - `sender` and `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. * - the caller must have allowance for ``sender``'s tokens of at least * `amount`. */
NatSpecMultiLine
v0.8.1+commit.df193b15
MIT
ipfs://b5a9bf50d6ab20fb6187e0977c4859ef104592e8af65af586f892117edccd45a
{ "func_code_index": [ 3557, 3984 ] }
1,101
BCUG
BCUG.sol
0x14da7b27b2e0fedefe0a664118b0c9bc68e2e9af
Solidity
ERC20
contract ERC20 is Context, IERC20 { mapping (address => uint256) private _balances; mapping (address => mapping (address => uint256)) private _allowances; uint256 private _totalSupply; string private _name; string private _symbol; /** * @dev Sets the values for {name} and {symbol}. * * The default value of {decimals} is 18. To select a different value for * {decimals} you should overload it. * * All three of these values are immutable: they can only be set once during * construction. */ constructor (string memory name_, string memory symbol_) { _name = name_; _symbol = symbol_; } /** * @dev Returns the name of the token. */ function name() public view virtual returns (string memory) { return _name; } /** * @dev Returns the symbol of the token, usually a shorter version of the * name. */ function symbol() public view virtual returns (string memory) { return _symbol; } /** * @dev Returns the number of decimals used to get its user representation. * For example, if `decimals` equals `2`, a balance of `505` tokens should * be displayed to a user as `5,05` (`505 / 10 ** 2`). * * Tokens usually opt for a value of 18, imitating the relationship between * Ether and Wei. This is the value {ERC20} uses, unless this function is * overloaded; * * NOTE: This information is only used for _display_ purposes: it in * no way affects any of the arithmetic of the contract, including * {IERC20-balanceOf} and {IERC20-transfer}. */ function decimals() public view virtual returns (uint8) { return 18; } /** * @dev See {IERC20-totalSupply}. */ function totalSupply() public view virtual override returns (uint256) { return _totalSupply; } /** * @dev See {IERC20-balanceOf}. */ function balanceOf(address account) public view virtual override returns (uint256) { return _balances[account]; } /** * @dev See {IERC20-transfer}. * * Requirements: * * - `recipient` cannot be the zero address. * - the caller must have a balance of at least `amount`. */ function transfer(address recipient, uint256 amount) public virtual override returns (bool) { _transfer(_msgSender(), recipient, amount); return true; } /** * @dev See {IERC20-allowance}. */ function allowance(address owner, address spender) public view virtual override returns (uint256) { return _allowances[owner][spender]; } /** * @dev See {IERC20-approve}. * * Requirements: * * - `spender` cannot be the zero address. */ function approve(address spender, uint256 amount) public virtual override returns (bool) { _approve(_msgSender(), spender, amount); return true; } /** * @dev See {IERC20-transferFrom}. * * Emits an {Approval} event indicating the updated allowance. This is not * required by the EIP. See the note at the beginning of {ERC20}. * * Requirements: * * - `sender` and `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. * - the caller must have allowance for ``sender``'s tokens of at least * `amount`. */ function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) { _transfer(sender, recipient, amount); uint256 currentAllowance = _allowances[sender][_msgSender()]; require(currentAllowance >= amount, "ERC20: transfer amount exceeds allowance"); _approve(sender, _msgSender(), currentAllowance - amount); return true; } /** * @dev Atomically increases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. */ function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender] + addedValue); return true; } /** * @dev Atomically decreases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. * - `spender` must have allowance for the caller of at least * `subtractedValue`. */ function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) { uint256 currentAllowance = _allowances[_msgSender()][spender]; require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero"); _approve(_msgSender(), spender, currentAllowance - subtractedValue); return true; } /** * @dev Moves tokens `amount` from `sender` to `recipient`. * * This is internal function is equivalent to {transfer}, and can be used to * e.g. implement automatic token fees, slashing mechanisms, etc. * * Emits a {Transfer} event. * * Requirements: * * - `sender` cannot be the zero address. * - `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. */ function _transfer(address sender, address recipient, uint256 amount) internal virtual { require(sender != address(0), "ERC20: transfer from the zero address"); require(recipient != address(0), "ERC20: transfer to the zero address"); _beforeTokenTransfer(sender, recipient, amount); uint256 senderBalance = _balances[sender]; require(senderBalance >= amount, "ERC20: transfer amount exceeds balance"); _balances[sender] = senderBalance - amount; _balances[recipient] += amount; emit Transfer(sender, recipient, amount); } /** @dev Creates `amount` tokens and assigns them to `account`, increasing * the total supply. * * Emits a {Transfer} event with `from` set to the zero address. * * Requirements: * * - `to` cannot be the zero address. */ function _mint(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: mint to the zero address"); _beforeTokenTransfer(address(0), account, amount); _totalSupply += amount; _balances[account] += amount; emit Transfer(address(0), account, amount); } /** * @dev Destroys `amount` tokens from `account`, reducing the * total supply. * * Emits a {Transfer} event with `to` set to the zero address. * * Requirements: * * - `account` cannot be the zero address. * - `account` must have at least `amount` tokens. */ function _burn(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: burn from the zero address"); _beforeTokenTransfer(account, address(0), amount); uint256 accountBalance = _balances[account]; require(accountBalance >= amount, "ERC20: burn amount exceeds balance"); _balances[account] = accountBalance - amount; _totalSupply -= amount; emit Transfer(account, address(0), amount); } /** * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens. * * This internal function is equivalent to `approve`, and can be used to * e.g. set automatic allowances for certain subsystems, etc. * * Emits an {Approval} event. * * Requirements: * * - `owner` cannot be the zero address. * - `spender` cannot be the zero address. */ function _approve(address owner, address spender, uint256 amount) internal virtual { require(owner != address(0), "ERC20: approve from the zero address"); require(spender != address(0), "ERC20: approve to the zero address"); _allowances[owner][spender] = amount; emit Approval(owner, spender, amount); } /** * @dev Hook that is called before any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens * will be to transferred to `to`. * - when `from` is zero, `amount` tokens will be minted for `to`. * - when `to` is zero, `amount` of ``from``'s tokens will be burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual { } }
/** * @dev Implementation of the {IERC20} interface. * * This implementation is agnostic to the way tokens are created. This means * that a supply mechanism has to be added in a derived contract using {_mint}. * For a generic mechanism see {ERC20PresetMinterPauser}. * * TIP: For a detailed writeup see our guide * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How * to implement supply mechanisms]. * * We have followed general OpenZeppelin guidelines: functions revert instead * of returning `false` on failure. This behavior is nonetheless conventional * and does not conflict with the expectations of ERC20 applications. * * Additionally, an {Approval} event is emitted on calls to {transferFrom}. * This allows applications to reconstruct the allowance for all accounts just * by listening to said events. Other implementations of the EIP may not emit * these events, as it isn't required by the specification. * * Finally, the non-standard {decreaseAllowance} and {increaseAllowance} * functions have been added to mitigate the well-known issues around setting * allowances. See {IERC20-approve}. */
NatSpecMultiLine
increaseAllowance
function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender] + addedValue); return true; }
/** * @dev Atomically increases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. */
NatSpecMultiLine
v0.8.1+commit.df193b15
MIT
ipfs://b5a9bf50d6ab20fb6187e0977c4859ef104592e8af65af586f892117edccd45a
{ "func_code_index": [ 4388, 4608 ] }
1,102
BCUG
BCUG.sol
0x14da7b27b2e0fedefe0a664118b0c9bc68e2e9af
Solidity
ERC20
contract ERC20 is Context, IERC20 { mapping (address => uint256) private _balances; mapping (address => mapping (address => uint256)) private _allowances; uint256 private _totalSupply; string private _name; string private _symbol; /** * @dev Sets the values for {name} and {symbol}. * * The default value of {decimals} is 18. To select a different value for * {decimals} you should overload it. * * All three of these values are immutable: they can only be set once during * construction. */ constructor (string memory name_, string memory symbol_) { _name = name_; _symbol = symbol_; } /** * @dev Returns the name of the token. */ function name() public view virtual returns (string memory) { return _name; } /** * @dev Returns the symbol of the token, usually a shorter version of the * name. */ function symbol() public view virtual returns (string memory) { return _symbol; } /** * @dev Returns the number of decimals used to get its user representation. * For example, if `decimals` equals `2`, a balance of `505` tokens should * be displayed to a user as `5,05` (`505 / 10 ** 2`). * * Tokens usually opt for a value of 18, imitating the relationship between * Ether and Wei. This is the value {ERC20} uses, unless this function is * overloaded; * * NOTE: This information is only used for _display_ purposes: it in * no way affects any of the arithmetic of the contract, including * {IERC20-balanceOf} and {IERC20-transfer}. */ function decimals() public view virtual returns (uint8) { return 18; } /** * @dev See {IERC20-totalSupply}. */ function totalSupply() public view virtual override returns (uint256) { return _totalSupply; } /** * @dev See {IERC20-balanceOf}. */ function balanceOf(address account) public view virtual override returns (uint256) { return _balances[account]; } /** * @dev See {IERC20-transfer}. * * Requirements: * * - `recipient` cannot be the zero address. * - the caller must have a balance of at least `amount`. */ function transfer(address recipient, uint256 amount) public virtual override returns (bool) { _transfer(_msgSender(), recipient, amount); return true; } /** * @dev See {IERC20-allowance}. */ function allowance(address owner, address spender) public view virtual override returns (uint256) { return _allowances[owner][spender]; } /** * @dev See {IERC20-approve}. * * Requirements: * * - `spender` cannot be the zero address. */ function approve(address spender, uint256 amount) public virtual override returns (bool) { _approve(_msgSender(), spender, amount); return true; } /** * @dev See {IERC20-transferFrom}. * * Emits an {Approval} event indicating the updated allowance. This is not * required by the EIP. See the note at the beginning of {ERC20}. * * Requirements: * * - `sender` and `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. * - the caller must have allowance for ``sender``'s tokens of at least * `amount`. */ function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) { _transfer(sender, recipient, amount); uint256 currentAllowance = _allowances[sender][_msgSender()]; require(currentAllowance >= amount, "ERC20: transfer amount exceeds allowance"); _approve(sender, _msgSender(), currentAllowance - amount); return true; } /** * @dev Atomically increases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. */ function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender] + addedValue); return true; } /** * @dev Atomically decreases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. * - `spender` must have allowance for the caller of at least * `subtractedValue`. */ function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) { uint256 currentAllowance = _allowances[_msgSender()][spender]; require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero"); _approve(_msgSender(), spender, currentAllowance - subtractedValue); return true; } /** * @dev Moves tokens `amount` from `sender` to `recipient`. * * This is internal function is equivalent to {transfer}, and can be used to * e.g. implement automatic token fees, slashing mechanisms, etc. * * Emits a {Transfer} event. * * Requirements: * * - `sender` cannot be the zero address. * - `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. */ function _transfer(address sender, address recipient, uint256 amount) internal virtual { require(sender != address(0), "ERC20: transfer from the zero address"); require(recipient != address(0), "ERC20: transfer to the zero address"); _beforeTokenTransfer(sender, recipient, amount); uint256 senderBalance = _balances[sender]; require(senderBalance >= amount, "ERC20: transfer amount exceeds balance"); _balances[sender] = senderBalance - amount; _balances[recipient] += amount; emit Transfer(sender, recipient, amount); } /** @dev Creates `amount` tokens and assigns them to `account`, increasing * the total supply. * * Emits a {Transfer} event with `from` set to the zero address. * * Requirements: * * - `to` cannot be the zero address. */ function _mint(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: mint to the zero address"); _beforeTokenTransfer(address(0), account, amount); _totalSupply += amount; _balances[account] += amount; emit Transfer(address(0), account, amount); } /** * @dev Destroys `amount` tokens from `account`, reducing the * total supply. * * Emits a {Transfer} event with `to` set to the zero address. * * Requirements: * * - `account` cannot be the zero address. * - `account` must have at least `amount` tokens. */ function _burn(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: burn from the zero address"); _beforeTokenTransfer(account, address(0), amount); uint256 accountBalance = _balances[account]; require(accountBalance >= amount, "ERC20: burn amount exceeds balance"); _balances[account] = accountBalance - amount; _totalSupply -= amount; emit Transfer(account, address(0), amount); } /** * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens. * * This internal function is equivalent to `approve`, and can be used to * e.g. set automatic allowances for certain subsystems, etc. * * Emits an {Approval} event. * * Requirements: * * - `owner` cannot be the zero address. * - `spender` cannot be the zero address. */ function _approve(address owner, address spender, uint256 amount) internal virtual { require(owner != address(0), "ERC20: approve from the zero address"); require(spender != address(0), "ERC20: approve to the zero address"); _allowances[owner][spender] = amount; emit Approval(owner, spender, amount); } /** * @dev Hook that is called before any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens * will be to transferred to `to`. * - when `from` is zero, `amount` tokens will be minted for `to`. * - when `to` is zero, `amount` of ``from``'s tokens will be burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual { } }
/** * @dev Implementation of the {IERC20} interface. * * This implementation is agnostic to the way tokens are created. This means * that a supply mechanism has to be added in a derived contract using {_mint}. * For a generic mechanism see {ERC20PresetMinterPauser}. * * TIP: For a detailed writeup see our guide * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How * to implement supply mechanisms]. * * We have followed general OpenZeppelin guidelines: functions revert instead * of returning `false` on failure. This behavior is nonetheless conventional * and does not conflict with the expectations of ERC20 applications. * * Additionally, an {Approval} event is emitted on calls to {transferFrom}. * This allows applications to reconstruct the allowance for all accounts just * by listening to said events. Other implementations of the EIP may not emit * these events, as it isn't required by the specification. * * Finally, the non-standard {decreaseAllowance} and {increaseAllowance} * functions have been added to mitigate the well-known issues around setting * allowances. See {IERC20-approve}. */
NatSpecMultiLine
decreaseAllowance
function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) { uint256 currentAllowance = _allowances[_msgSender()][spender]; require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero"); _approve(_msgSender(), spender, currentAllowance - subtractedValue); return true; }
/** * @dev Atomically decreases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. * - `spender` must have allowance for the caller of at least * `subtractedValue`. */
NatSpecMultiLine
v0.8.1+commit.df193b15
MIT
ipfs://b5a9bf50d6ab20fb6187e0977c4859ef104592e8af65af586f892117edccd45a
{ "func_code_index": [ 5106, 5488 ] }
1,103
BCUG
BCUG.sol
0x14da7b27b2e0fedefe0a664118b0c9bc68e2e9af
Solidity
ERC20
contract ERC20 is Context, IERC20 { mapping (address => uint256) private _balances; mapping (address => mapping (address => uint256)) private _allowances; uint256 private _totalSupply; string private _name; string private _symbol; /** * @dev Sets the values for {name} and {symbol}. * * The default value of {decimals} is 18. To select a different value for * {decimals} you should overload it. * * All three of these values are immutable: they can only be set once during * construction. */ constructor (string memory name_, string memory symbol_) { _name = name_; _symbol = symbol_; } /** * @dev Returns the name of the token. */ function name() public view virtual returns (string memory) { return _name; } /** * @dev Returns the symbol of the token, usually a shorter version of the * name. */ function symbol() public view virtual returns (string memory) { return _symbol; } /** * @dev Returns the number of decimals used to get its user representation. * For example, if `decimals` equals `2`, a balance of `505` tokens should * be displayed to a user as `5,05` (`505 / 10 ** 2`). * * Tokens usually opt for a value of 18, imitating the relationship between * Ether and Wei. This is the value {ERC20} uses, unless this function is * overloaded; * * NOTE: This information is only used for _display_ purposes: it in * no way affects any of the arithmetic of the contract, including * {IERC20-balanceOf} and {IERC20-transfer}. */ function decimals() public view virtual returns (uint8) { return 18; } /** * @dev See {IERC20-totalSupply}. */ function totalSupply() public view virtual override returns (uint256) { return _totalSupply; } /** * @dev See {IERC20-balanceOf}. */ function balanceOf(address account) public view virtual override returns (uint256) { return _balances[account]; } /** * @dev See {IERC20-transfer}. * * Requirements: * * - `recipient` cannot be the zero address. * - the caller must have a balance of at least `amount`. */ function transfer(address recipient, uint256 amount) public virtual override returns (bool) { _transfer(_msgSender(), recipient, amount); return true; } /** * @dev See {IERC20-allowance}. */ function allowance(address owner, address spender) public view virtual override returns (uint256) { return _allowances[owner][spender]; } /** * @dev See {IERC20-approve}. * * Requirements: * * - `spender` cannot be the zero address. */ function approve(address spender, uint256 amount) public virtual override returns (bool) { _approve(_msgSender(), spender, amount); return true; } /** * @dev See {IERC20-transferFrom}. * * Emits an {Approval} event indicating the updated allowance. This is not * required by the EIP. See the note at the beginning of {ERC20}. * * Requirements: * * - `sender` and `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. * - the caller must have allowance for ``sender``'s tokens of at least * `amount`. */ function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) { _transfer(sender, recipient, amount); uint256 currentAllowance = _allowances[sender][_msgSender()]; require(currentAllowance >= amount, "ERC20: transfer amount exceeds allowance"); _approve(sender, _msgSender(), currentAllowance - amount); return true; } /** * @dev Atomically increases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. */ function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender] + addedValue); return true; } /** * @dev Atomically decreases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. * - `spender` must have allowance for the caller of at least * `subtractedValue`. */ function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) { uint256 currentAllowance = _allowances[_msgSender()][spender]; require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero"); _approve(_msgSender(), spender, currentAllowance - subtractedValue); return true; } /** * @dev Moves tokens `amount` from `sender` to `recipient`. * * This is internal function is equivalent to {transfer}, and can be used to * e.g. implement automatic token fees, slashing mechanisms, etc. * * Emits a {Transfer} event. * * Requirements: * * - `sender` cannot be the zero address. * - `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. */ function _transfer(address sender, address recipient, uint256 amount) internal virtual { require(sender != address(0), "ERC20: transfer from the zero address"); require(recipient != address(0), "ERC20: transfer to the zero address"); _beforeTokenTransfer(sender, recipient, amount); uint256 senderBalance = _balances[sender]; require(senderBalance >= amount, "ERC20: transfer amount exceeds balance"); _balances[sender] = senderBalance - amount; _balances[recipient] += amount; emit Transfer(sender, recipient, amount); } /** @dev Creates `amount` tokens and assigns them to `account`, increasing * the total supply. * * Emits a {Transfer} event with `from` set to the zero address. * * Requirements: * * - `to` cannot be the zero address. */ function _mint(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: mint to the zero address"); _beforeTokenTransfer(address(0), account, amount); _totalSupply += amount; _balances[account] += amount; emit Transfer(address(0), account, amount); } /** * @dev Destroys `amount` tokens from `account`, reducing the * total supply. * * Emits a {Transfer} event with `to` set to the zero address. * * Requirements: * * - `account` cannot be the zero address. * - `account` must have at least `amount` tokens. */ function _burn(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: burn from the zero address"); _beforeTokenTransfer(account, address(0), amount); uint256 accountBalance = _balances[account]; require(accountBalance >= amount, "ERC20: burn amount exceeds balance"); _balances[account] = accountBalance - amount; _totalSupply -= amount; emit Transfer(account, address(0), amount); } /** * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens. * * This internal function is equivalent to `approve`, and can be used to * e.g. set automatic allowances for certain subsystems, etc. * * Emits an {Approval} event. * * Requirements: * * - `owner` cannot be the zero address. * - `spender` cannot be the zero address. */ function _approve(address owner, address spender, uint256 amount) internal virtual { require(owner != address(0), "ERC20: approve from the zero address"); require(spender != address(0), "ERC20: approve to the zero address"); _allowances[owner][spender] = amount; emit Approval(owner, spender, amount); } /** * @dev Hook that is called before any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens * will be to transferred to `to`. * - when `from` is zero, `amount` tokens will be minted for `to`. * - when `to` is zero, `amount` of ``from``'s tokens will be burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual { } }
/** * @dev Implementation of the {IERC20} interface. * * This implementation is agnostic to the way tokens are created. This means * that a supply mechanism has to be added in a derived contract using {_mint}. * For a generic mechanism see {ERC20PresetMinterPauser}. * * TIP: For a detailed writeup see our guide * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How * to implement supply mechanisms]. * * We have followed general OpenZeppelin guidelines: functions revert instead * of returning `false` on failure. This behavior is nonetheless conventional * and does not conflict with the expectations of ERC20 applications. * * Additionally, an {Approval} event is emitted on calls to {transferFrom}. * This allows applications to reconstruct the allowance for all accounts just * by listening to said events. Other implementations of the EIP may not emit * these events, as it isn't required by the specification. * * Finally, the non-standard {decreaseAllowance} and {increaseAllowance} * functions have been added to mitigate the well-known issues around setting * allowances. See {IERC20-approve}. */
NatSpecMultiLine
_transfer
function _transfer(address sender, address recipient, uint256 amount) internal virtual { require(sender != address(0), "ERC20: transfer from the zero address"); require(recipient != address(0), "ERC20: transfer to the zero address"); _beforeTokenTransfer(sender, recipient, amount); uint256 senderBalance = _balances[sender]; require(senderBalance >= amount, "ERC20: transfer amount exceeds balance"); _balances[sender] = senderBalance - amount; _balances[recipient] += amount; emit Transfer(sender, recipient, amount); }
/** * @dev Moves tokens `amount` from `sender` to `recipient`. * * This is internal function is equivalent to {transfer}, and can be used to * e.g. implement automatic token fees, slashing mechanisms, etc. * * Emits a {Transfer} event. * * Requirements: * * - `sender` cannot be the zero address. * - `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. */
NatSpecMultiLine
v0.8.1+commit.df193b15
MIT
ipfs://b5a9bf50d6ab20fb6187e0977c4859ef104592e8af65af586f892117edccd45a
{ "func_code_index": [ 5973, 6582 ] }
1,104
BCUG
BCUG.sol
0x14da7b27b2e0fedefe0a664118b0c9bc68e2e9af
Solidity
ERC20
contract ERC20 is Context, IERC20 { mapping (address => uint256) private _balances; mapping (address => mapping (address => uint256)) private _allowances; uint256 private _totalSupply; string private _name; string private _symbol; /** * @dev Sets the values for {name} and {symbol}. * * The default value of {decimals} is 18. To select a different value for * {decimals} you should overload it. * * All three of these values are immutable: they can only be set once during * construction. */ constructor (string memory name_, string memory symbol_) { _name = name_; _symbol = symbol_; } /** * @dev Returns the name of the token. */ function name() public view virtual returns (string memory) { return _name; } /** * @dev Returns the symbol of the token, usually a shorter version of the * name. */ function symbol() public view virtual returns (string memory) { return _symbol; } /** * @dev Returns the number of decimals used to get its user representation. * For example, if `decimals` equals `2`, a balance of `505` tokens should * be displayed to a user as `5,05` (`505 / 10 ** 2`). * * Tokens usually opt for a value of 18, imitating the relationship between * Ether and Wei. This is the value {ERC20} uses, unless this function is * overloaded; * * NOTE: This information is only used for _display_ purposes: it in * no way affects any of the arithmetic of the contract, including * {IERC20-balanceOf} and {IERC20-transfer}. */ function decimals() public view virtual returns (uint8) { return 18; } /** * @dev See {IERC20-totalSupply}. */ function totalSupply() public view virtual override returns (uint256) { return _totalSupply; } /** * @dev See {IERC20-balanceOf}. */ function balanceOf(address account) public view virtual override returns (uint256) { return _balances[account]; } /** * @dev See {IERC20-transfer}. * * Requirements: * * - `recipient` cannot be the zero address. * - the caller must have a balance of at least `amount`. */ function transfer(address recipient, uint256 amount) public virtual override returns (bool) { _transfer(_msgSender(), recipient, amount); return true; } /** * @dev See {IERC20-allowance}. */ function allowance(address owner, address spender) public view virtual override returns (uint256) { return _allowances[owner][spender]; } /** * @dev See {IERC20-approve}. * * Requirements: * * - `spender` cannot be the zero address. */ function approve(address spender, uint256 amount) public virtual override returns (bool) { _approve(_msgSender(), spender, amount); return true; } /** * @dev See {IERC20-transferFrom}. * * Emits an {Approval} event indicating the updated allowance. This is not * required by the EIP. See the note at the beginning of {ERC20}. * * Requirements: * * - `sender` and `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. * - the caller must have allowance for ``sender``'s tokens of at least * `amount`. */ function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) { _transfer(sender, recipient, amount); uint256 currentAllowance = _allowances[sender][_msgSender()]; require(currentAllowance >= amount, "ERC20: transfer amount exceeds allowance"); _approve(sender, _msgSender(), currentAllowance - amount); return true; } /** * @dev Atomically increases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. */ function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender] + addedValue); return true; } /** * @dev Atomically decreases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. * - `spender` must have allowance for the caller of at least * `subtractedValue`. */ function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) { uint256 currentAllowance = _allowances[_msgSender()][spender]; require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero"); _approve(_msgSender(), spender, currentAllowance - subtractedValue); return true; } /** * @dev Moves tokens `amount` from `sender` to `recipient`. * * This is internal function is equivalent to {transfer}, and can be used to * e.g. implement automatic token fees, slashing mechanisms, etc. * * Emits a {Transfer} event. * * Requirements: * * - `sender` cannot be the zero address. * - `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. */ function _transfer(address sender, address recipient, uint256 amount) internal virtual { require(sender != address(0), "ERC20: transfer from the zero address"); require(recipient != address(0), "ERC20: transfer to the zero address"); _beforeTokenTransfer(sender, recipient, amount); uint256 senderBalance = _balances[sender]; require(senderBalance >= amount, "ERC20: transfer amount exceeds balance"); _balances[sender] = senderBalance - amount; _balances[recipient] += amount; emit Transfer(sender, recipient, amount); } /** @dev Creates `amount` tokens and assigns them to `account`, increasing * the total supply. * * Emits a {Transfer} event with `from` set to the zero address. * * Requirements: * * - `to` cannot be the zero address. */ function _mint(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: mint to the zero address"); _beforeTokenTransfer(address(0), account, amount); _totalSupply += amount; _balances[account] += amount; emit Transfer(address(0), account, amount); } /** * @dev Destroys `amount` tokens from `account`, reducing the * total supply. * * Emits a {Transfer} event with `to` set to the zero address. * * Requirements: * * - `account` cannot be the zero address. * - `account` must have at least `amount` tokens. */ function _burn(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: burn from the zero address"); _beforeTokenTransfer(account, address(0), amount); uint256 accountBalance = _balances[account]; require(accountBalance >= amount, "ERC20: burn amount exceeds balance"); _balances[account] = accountBalance - amount; _totalSupply -= amount; emit Transfer(account, address(0), amount); } /** * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens. * * This internal function is equivalent to `approve`, and can be used to * e.g. set automatic allowances for certain subsystems, etc. * * Emits an {Approval} event. * * Requirements: * * - `owner` cannot be the zero address. * - `spender` cannot be the zero address. */ function _approve(address owner, address spender, uint256 amount) internal virtual { require(owner != address(0), "ERC20: approve from the zero address"); require(spender != address(0), "ERC20: approve to the zero address"); _allowances[owner][spender] = amount; emit Approval(owner, spender, amount); } /** * @dev Hook that is called before any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens * will be to transferred to `to`. * - when `from` is zero, `amount` tokens will be minted for `to`. * - when `to` is zero, `amount` of ``from``'s tokens will be burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual { } }
/** * @dev Implementation of the {IERC20} interface. * * This implementation is agnostic to the way tokens are created. This means * that a supply mechanism has to be added in a derived contract using {_mint}. * For a generic mechanism see {ERC20PresetMinterPauser}. * * TIP: For a detailed writeup see our guide * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How * to implement supply mechanisms]. * * We have followed general OpenZeppelin guidelines: functions revert instead * of returning `false` on failure. This behavior is nonetheless conventional * and does not conflict with the expectations of ERC20 applications. * * Additionally, an {Approval} event is emitted on calls to {transferFrom}. * This allows applications to reconstruct the allowance for all accounts just * by listening to said events. Other implementations of the EIP may not emit * these events, as it isn't required by the specification. * * Finally, the non-standard {decreaseAllowance} and {increaseAllowance} * functions have been added to mitigate the well-known issues around setting * allowances. See {IERC20-approve}. */
NatSpecMultiLine
_mint
function _mint(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: mint to the zero address"); _beforeTokenTransfer(address(0), account, amount); _totalSupply += amount; _balances[account] += amount; emit Transfer(address(0), account, amount); }
/** @dev Creates `amount` tokens and assigns them to `account`, increasing * the total supply. * * Emits a {Transfer} event with `from` set to the zero address. * * Requirements: * * - `to` cannot be the zero address. */
NatSpecMultiLine
v0.8.1+commit.df193b15
MIT
ipfs://b5a9bf50d6ab20fb6187e0977c4859ef104592e8af65af586f892117edccd45a
{ "func_code_index": [ 6859, 7202 ] }
1,105
BCUG
BCUG.sol
0x14da7b27b2e0fedefe0a664118b0c9bc68e2e9af
Solidity
ERC20
contract ERC20 is Context, IERC20 { mapping (address => uint256) private _balances; mapping (address => mapping (address => uint256)) private _allowances; uint256 private _totalSupply; string private _name; string private _symbol; /** * @dev Sets the values for {name} and {symbol}. * * The default value of {decimals} is 18. To select a different value for * {decimals} you should overload it. * * All three of these values are immutable: they can only be set once during * construction. */ constructor (string memory name_, string memory symbol_) { _name = name_; _symbol = symbol_; } /** * @dev Returns the name of the token. */ function name() public view virtual returns (string memory) { return _name; } /** * @dev Returns the symbol of the token, usually a shorter version of the * name. */ function symbol() public view virtual returns (string memory) { return _symbol; } /** * @dev Returns the number of decimals used to get its user representation. * For example, if `decimals` equals `2`, a balance of `505` tokens should * be displayed to a user as `5,05` (`505 / 10 ** 2`). * * Tokens usually opt for a value of 18, imitating the relationship between * Ether and Wei. This is the value {ERC20} uses, unless this function is * overloaded; * * NOTE: This information is only used for _display_ purposes: it in * no way affects any of the arithmetic of the contract, including * {IERC20-balanceOf} and {IERC20-transfer}. */ function decimals() public view virtual returns (uint8) { return 18; } /** * @dev See {IERC20-totalSupply}. */ function totalSupply() public view virtual override returns (uint256) { return _totalSupply; } /** * @dev See {IERC20-balanceOf}. */ function balanceOf(address account) public view virtual override returns (uint256) { return _balances[account]; } /** * @dev See {IERC20-transfer}. * * Requirements: * * - `recipient` cannot be the zero address. * - the caller must have a balance of at least `amount`. */ function transfer(address recipient, uint256 amount) public virtual override returns (bool) { _transfer(_msgSender(), recipient, amount); return true; } /** * @dev See {IERC20-allowance}. */ function allowance(address owner, address spender) public view virtual override returns (uint256) { return _allowances[owner][spender]; } /** * @dev See {IERC20-approve}. * * Requirements: * * - `spender` cannot be the zero address. */ function approve(address spender, uint256 amount) public virtual override returns (bool) { _approve(_msgSender(), spender, amount); return true; } /** * @dev See {IERC20-transferFrom}. * * Emits an {Approval} event indicating the updated allowance. This is not * required by the EIP. See the note at the beginning of {ERC20}. * * Requirements: * * - `sender` and `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. * - the caller must have allowance for ``sender``'s tokens of at least * `amount`. */ function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) { _transfer(sender, recipient, amount); uint256 currentAllowance = _allowances[sender][_msgSender()]; require(currentAllowance >= amount, "ERC20: transfer amount exceeds allowance"); _approve(sender, _msgSender(), currentAllowance - amount); return true; } /** * @dev Atomically increases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. */ function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender] + addedValue); return true; } /** * @dev Atomically decreases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. * - `spender` must have allowance for the caller of at least * `subtractedValue`. */ function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) { uint256 currentAllowance = _allowances[_msgSender()][spender]; require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero"); _approve(_msgSender(), spender, currentAllowance - subtractedValue); return true; } /** * @dev Moves tokens `amount` from `sender` to `recipient`. * * This is internal function is equivalent to {transfer}, and can be used to * e.g. implement automatic token fees, slashing mechanisms, etc. * * Emits a {Transfer} event. * * Requirements: * * - `sender` cannot be the zero address. * - `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. */ function _transfer(address sender, address recipient, uint256 amount) internal virtual { require(sender != address(0), "ERC20: transfer from the zero address"); require(recipient != address(0), "ERC20: transfer to the zero address"); _beforeTokenTransfer(sender, recipient, amount); uint256 senderBalance = _balances[sender]; require(senderBalance >= amount, "ERC20: transfer amount exceeds balance"); _balances[sender] = senderBalance - amount; _balances[recipient] += amount; emit Transfer(sender, recipient, amount); } /** @dev Creates `amount` tokens and assigns them to `account`, increasing * the total supply. * * Emits a {Transfer} event with `from` set to the zero address. * * Requirements: * * - `to` cannot be the zero address. */ function _mint(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: mint to the zero address"); _beforeTokenTransfer(address(0), account, amount); _totalSupply += amount; _balances[account] += amount; emit Transfer(address(0), account, amount); } /** * @dev Destroys `amount` tokens from `account`, reducing the * total supply. * * Emits a {Transfer} event with `to` set to the zero address. * * Requirements: * * - `account` cannot be the zero address. * - `account` must have at least `amount` tokens. */ function _burn(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: burn from the zero address"); _beforeTokenTransfer(account, address(0), amount); uint256 accountBalance = _balances[account]; require(accountBalance >= amount, "ERC20: burn amount exceeds balance"); _balances[account] = accountBalance - amount; _totalSupply -= amount; emit Transfer(account, address(0), amount); } /** * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens. * * This internal function is equivalent to `approve`, and can be used to * e.g. set automatic allowances for certain subsystems, etc. * * Emits an {Approval} event. * * Requirements: * * - `owner` cannot be the zero address. * - `spender` cannot be the zero address. */ function _approve(address owner, address spender, uint256 amount) internal virtual { require(owner != address(0), "ERC20: approve from the zero address"); require(spender != address(0), "ERC20: approve to the zero address"); _allowances[owner][spender] = amount; emit Approval(owner, spender, amount); } /** * @dev Hook that is called before any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens * will be to transferred to `to`. * - when `from` is zero, `amount` tokens will be minted for `to`. * - when `to` is zero, `amount` of ``from``'s tokens will be burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual { } }
/** * @dev Implementation of the {IERC20} interface. * * This implementation is agnostic to the way tokens are created. This means * that a supply mechanism has to be added in a derived contract using {_mint}. * For a generic mechanism see {ERC20PresetMinterPauser}. * * TIP: For a detailed writeup see our guide * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How * to implement supply mechanisms]. * * We have followed general OpenZeppelin guidelines: functions revert instead * of returning `false` on failure. This behavior is nonetheless conventional * and does not conflict with the expectations of ERC20 applications. * * Additionally, an {Approval} event is emitted on calls to {transferFrom}. * This allows applications to reconstruct the allowance for all accounts just * by listening to said events. Other implementations of the EIP may not emit * these events, as it isn't required by the specification. * * Finally, the non-standard {decreaseAllowance} and {increaseAllowance} * functions have been added to mitigate the well-known issues around setting * allowances. See {IERC20-approve}. */
NatSpecMultiLine
_burn
function _burn(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: burn from the zero address"); _beforeTokenTransfer(account, address(0), amount); uint256 accountBalance = _balances[account]; require(accountBalance >= amount, "ERC20: burn amount exceeds balance"); _balances[account] = accountBalance - amount; _totalSupply -= amount; emit Transfer(account, address(0), amount); }
/** * @dev Destroys `amount` tokens from `account`, reducing the * total supply. * * Emits a {Transfer} event with `to` set to the zero address. * * Requirements: * * - `account` cannot be the zero address. * - `account` must have at least `amount` tokens. */
NatSpecMultiLine
v0.8.1+commit.df193b15
MIT
ipfs://b5a9bf50d6ab20fb6187e0977c4859ef104592e8af65af586f892117edccd45a
{ "func_code_index": [ 7530, 8029 ] }
1,106